编程学习网为您整理以下代码实例,主要实现:使用%u或%lu说明符,希望可以帮到各位朋友。
#include <stdio.h>
#include <string.h> /* provIDes strlen() prototype */
#define PRAISE "this is a test test test test."
int main(voID)
{
char name[40];
printf("What's your name? ");
scanf("%s", name);
printf("Hello, %s. %s\n", name, PRAISE);
printf("Your name of %zd letters occupIEs %zd memory cells.\n", strlen(name), sizeof name);
printf("It has %zd letters ", strlen(PRAISE));
printf("and occupIEs %zd memory cells.\n", sizeof PRAISE);
return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!