Nižšie sú uvedené niektoré zaujímavé fakty o programovaní v C:
1)
Označenia prípadu príkazu switch sa môžu vyskytnúť vo vnútri príkazov if-else.
C
#include int main() { int a = 2 b = 2; switch(a) { case 1: ; if (b==5) { case 2: printf('GeeksforGeeks'); } else case 3: { } } }
výstup:
GeeksforGeeks2)
arr[index] je rovnaký ako index[arr] Dôvod, prečo to funguje, je, že k prvkom poľa sa pristupuje pomocou aritmetiky ukazovateľa.
C// C program to demonstrate that arr[0] and // 0[arr] #include int main() { int arr[10]; arr[0] = 1; printf('%d' 0[arr] ); return 0; }
výstup:
aplikácie cloud computingu
13)
Môžeme použiť '<: :>' namiesto '[]' a '<% %>' namiesto '{}'
C#include int main() <% int arr <:10:>; arr<:0:> = 1; printf('%d' arr<:0:>); return 0; %>
výstup:
14)
mysql sa nerovná
Používanie #include na zvláštnych miestach. Nech 'a.txt' obsahuje ('GeeksforGeeks');
CPP#include int main() { printf #include 'a.txt' ; }
výstup:
GeeksforGeeks5)
Vstup v scanf() môžeme ignorovať použitím '*' za '%' v špecifikátoroch formátu
C#include int main() { int a; // Let we input 10 20 we get output as 20 // (First input is ignored) // If we remove * from below line we get 10. scanf('%*d%d' &a); printf( '%d ' a); return 0; }