Array Name as Pointer in C – Why *(a + 1) Equals a[1]

*(a + 1) looks like pointer code, but a is an array — is that even allowed? Not only allowed: it’s the very definition of how arrays work in C. This question from our C Programming Quiz App tests array decay — the rule that quietly converts every array name into a pointer, and makes …

strlen in C – Why strlen(“hello”) Is 5, Not 4 or 6

How long is “hello”? Five letters — but C strings end with a hidden ‘\0’, arrays are indexed from zero, and sizeof gives yet another number. This question from our C Programming Quiz App sorts out exactly which number strlen returns — and which off-by-one traps produce every wrong option. The Quiz Question char *p …

Char Array vs String Literal in C – Which One Can You Modify?

Writing into a string: sometimes it works perfectly, sometimes it crashes on the spot — and the difference is a single character in the declaration. This question from our C Programming Quiz App is the definitive test of whether you know what char s[] = “hello” actually creates. The Quiz Question char s[] = “hello”; …

Partial Array Initialization in C – Why a[3] Is 0, Not Garbage

You gave the array five slots but only two values. What lives in slot three — leftover memory garbage, or something the language guarantees? This question from our C Programming Quiz App tests one of C’s most useful (and most doubted) rules: a partial initializer zero-fills everything you didn’t mention. The Quiz Question int a[5] …

sizeof of a String Array in C – Why “hi” Takes 3 Bytes

How big is the array behind the string “hi”? Two characters, so two bytes — right? This question from our C Programming Quiz App catches everyone who forgets that C strings carry an invisible passenger: the null terminator. sizeof sees it; your eyes don’t. The Quiz Question char str[] = “hi”; printf(“%lu”, sizeof(str)); What is …