Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8992969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:05:13+00:00 2026-06-15T23:05:13+00:00

#include stdio.h #include conio.h int main() { char str1[]=asc(20); char str2[]=SpApp|; strcat(str1,str2); printf(str1); getch();

  • 0
#include "stdio.h"
#include "conio.h"
int main()
{
    char str1[]=asc(20);
    char str2[]="SpApp|";
    strcat(str1,str2);  
    printf(str1);
    getch();  
}

I want to write a program which convert int to ASCII code first and then it concatenate with SpApp| and prints the values in c program.

Although printf("%c",20); also gives ASCII conversion, but I’m not getting how to save it in another char str1[] and then concatenate it with char str2[];

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:05:14+00:00Added an answer on June 15, 2026 at 11:05 pm

    The asc function returns a single character, not a string, so the array str1 will not contain the terminating special character '\0'.

    You have to initialize str1 properly:

    char str1[] = { asc(20), '\0' };
    

    The second problem is that the destination string str2 is not big enough to contain both the string you start with and the extra string you want to add to it. You need to make it big enough to contain both strings:

    char str2[16] = "...";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include<conio.h> #include<stdio.h> #define abc 7 int main() { int abc=1; printf(%d,abc); getch(); return 0;
#include<stdio.h> #include<conio.h> int main (void) { int a,b,c,d; clrscr(); a=3; b=5; c=a,b; d=(a,b); printf(c=%d,c);
#include <stdio.h> void wrapperPrint(char* s) { printf(s); return; } int main() { wrapperPrint(Hello world\n);
#include stdio.h #include conio.h #include <iostream> using namespace std; int main (void) { char
#include<stdio.h> #include<conio.h> int main(){ char i; int c; scanf(%i,&c); scanf(%c,&i);// catch the new line
#include<stdio.h> #include<stdlib.h> char* re() { char *p = hello; return p; } int main()
#include<stdio.h> #include<math.h> int main(int argc, char **argv){ // read in the command-line argument double
I am thinking of something like: #include <stdio.h> #include <conio.h> #include <stdlib.h> int main(void)
So basically: #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> int main(void){ //test strrev
this program hangs after taking first argument:- #include <stdio.h> #include <conio.h> void ellip(char*,...); int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.