Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,094 questions

40,775 answers

573 users

How to concatenate a string and int in C

1 Answer

0 votes
#include <stdio.h>

int main() {
    int i = 738;
    char s[32] = "c programming";
    char buf[64] = "";

    snprintf(buf, 64, "%s - %d", s, i);
    printf("%s\n", buf);

    return 0;
}




/*
run

programming - 738

*/

 





answered May 2, 2021 by avibootz

Related questions

1 answer 68 views
68 views asked May 3, 2021 by avibootz
1 answer 25 views
1 answer 80 views
1 answer 80 views
...