fork download
  1. #include <stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char str1[] = "MCA\0";
  6. char str2[] = {'M', 'C', 'A'};
  7. int n1 = sizeof(str1)/sizeof(str1[0]);
  8. int n2 = sizeof(str2)/strlen(str2);
  9. printf("n1=%d,n2=%d", n1, n2);
  10. return 0; }
  11.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
n1=5,n2=1