#include <stdio.h> char s[]="sfksfls "; void main() { printf(s); }
Why it can work? I just input the char pointer to printf
A string literal in C is a pointer to const char. printf takes a pointer to const char (plus an optional list of additional arguments). Passing it directly or through a variable makes no difference, a pointer is a pointer, it's just a number.
const char
printf
2.1m questions
2.1m answers
60 comments
57.0k users