Search code examples
cstringformat-specifiers

C printf string specifier \t1?


I am reading a piece of C heap sorting code and encounter this:

 do{
    printf("\n\t\t1:INSERT\n");
    printf("\n\t\t2:SEARCH\n");
    printf("\n\t\t3:DELETE\n");
    printf("\n\t\t1:DISPLAY\n");
    printf("Enter your choise\n");
    scanf("%d",&choise);
    switch(choise)
    {
        case 1: printf("Enter value to insert\n");
                scanf("%d",&val);
                last=insert(root,val);
                break;
        case 2:printf("Enter value for search \n");
                scanf("%d",&val);
                search(root,val);
                break;
        case 3:delete(root);
                delete(last);
                break;
        case 4:printf("\n\tHEAP\n");
                display(root);
                break;
        default : printf("INVALID choise ... can't you see properly?\n");

    }

Anyone knows whats \t1 and \t2 in the printfs and how do they work? I tried google but did not get any useful information. Thank you.


Solution

  • \t denotes a tab character. The 1 and 2 are nothing to do with it; they are just literal 1 and 2.