ログイン
kid's world

文字列型?

char s[10];
s[0] = 'A';
s[1] = 'B';
s[2] = 'C';
s[3] = '\0';

/c/string-fig1.png

printf("ABC");
printf("ABC");
#include <stdio.h>

main()
{
  char *s;
  
  s = "ABC";
  printf(s);
}
#include <stdio.h>

main()
{
  char s[4] = {'A', 'B', 'C', '\0'};

  printf(s);
}
char s[] = {'A', 'B', 'C', '\0'};
char s[] = "ABC";
char s[10];
s = "ABC";
#include <stdio.h>

main()
{
  char *s;
  
  s = "ABC";
  printf("%X\n%X\n",s,&s);
}

/c/string-fig2.png

/c/string-fig3.png


広告


©Toshio Koide 1996-2007.

mail.gif

広告