#' backslash 0' does anyone know what the meaning of it in this case?

11 messages · Page 1 of 1 (latest)

vivid lark
#
#include<stdio.h>
int main()
{
  long int T;
  scanf("%ld",&T);
  
  char str [1000];
    for(int i=0; i<T;i++){
      scanf("%s",&str);
      printf("Case #%ld: ",i+1);
      
        for(int j=0;str[j]!='\0';j++){
          printf("%ld",str[j]);
          if(str[j+1] !='\0'){
            printf("-");
          }
        }
      printf("\n");
    }
    return 0;
}```
unkempt capeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

vivid lark
#

' 0' does anyone know what the meaning of it in this case?

#

' backslash 0' does anyone know what the meaning of it in this case?

magic gull
#

It means the null character

#

Basically all characters have some number associated with them. The character with the number of 0 is the null character and usually represents the end of a string

vivid lark
vivid lark
upper shard
#

Strings are null terminated.

magic gull
#

It how code which loops over the characters of a string know when the string ends

unkempt capeBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.