Format specifiers (%d, %f, %s)
Në shqip: Specifikuesit e formatit
ShpjegimiSQ
Specifikuesit e formatit i tregojnë printf-it dhe scanf-it çfarë lloj vlere të presin: %d për int, %f për float (%lf te scanf për double), %c për një shkronjë, %s për tekst dhe %p për adresë memorieje. Po e përdore të gabuarin, del rezultat i çuditshëm.
EnglishEN
Format specifiers tell printf and scanf what kind of value to expect: %d for int, %f for float (%lf in scanf for double), %c for a character, %s for text and %p for a memory address. Use the wrong one and you get strange output.
Si ta mendosh
Si format-et e ndryshme të prizave: spina e duhur në prizën e duhur — përndryshe s'punon ose del shkëndijë.
Lexoje në anglisht
Like different socket shapes: the right plug in the right socket — otherwise it doesn't work or it sparks.
Shembull kodic
printf("%d\n", 42); // 42
printf("%.2f\n", 3.14159); // 3.14
printf("%c %s\n", 'A', "Arta");