Hi,
Following is my simple code. but it is not giving expected output. here is my code.
expected output is
but curretly it is coming as
Following is my simple code. but it is not giving expected output. here is my code.
C:
#include<iostream>
#include<stdio.h>
using namespace std;
typedef unsigned char Ch;
typedef struct abc_s
{
int f;
char x;
}abc_t;
int main()
{
Ch a,b,c,d;
abc_t stru;
char *arr;
stru.f = 20;
stru.x = 'H';
a = 'O';
b = 'B';
c = 'B';
d = '!';
cout<<"Start"<<endl;
snprintf(arr,6,"%c%c%c%c%c",stru.x,a,b,c,d);
cout<<arr<<endl;
}
expected output is
Code:
Start
HOBB!
Code:
Start
Last edited by a moderator: