[Solved] Cannot concatenate int and string in c [closed]


Maybe you want this :

#include <stdio.h>

void main()
{
    char buffer[30];  // note it's 30 now, with 10 the buffer will overflow
    int degrees=9;
    sprintf(buffer, "turnAnticlockwise(%d)",degrees);
    printf("%s", buffer);
}

This small program will output :

turnAnticlockwise(9)

solved Cannot concatenate int and string in c [closed]