- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
- PC Specs
- Linux
50 Posted Topics
Hello everyone! this is a code to reverse strings of a array of char ptr. I am passing the char* array, dynamically allocating memory to reverse and link with the char* array. The print it gives in the str_rev() are perfect. But when I print same thing in main(), it … | |
Hello Everyone, I got this question in some book. As per question we need to find a substring in a array of char* and replace it with another string. The program I wrote doesn't work. I tried using strcpy as well char by char. Please help me to figure out … | |
Hello, day's greet!! I was trying to pass a 3D array. But the following code generate error. Please tell me where am I wrong and why. Thanks a lot !!!! #include<stdio.h> void print_all(int [][][],int,int,int); int main() { int degree=3, row=2, col=3; int arr[3][2][3] = { {1,2,3, 4,5,6 }, {7,8,9, 10,11,12 … | |
What is the maximum buffer size allowed in memecpy() function in c, I am using GCC compiler,32-bit system, What is the affecting factor for memcpy failure? ->Alignment issue? ->Size? however the buffer size 256bytes not working, tried 160 bytes copy which fits our requirement | |
Hello, I want to duplicate a list in python. The way I want is, I need two list with same content pointing to different memory Location. What I tried is Dup_List = Original_List[:] , but lookes like even this is making both list point to same memory location. Both the … | |
Hi, I have a device connected to the USB port of the laptop. This device pumps data to the port which is read by the python script. As per the baudrate of the board I use folowing configuration to open the port. Serial(options.port,921600,timeout=0.2,xonxoff=0,rtscts=1) But when I analyse the collected LOG … | |
Hello, in this code snippet I am not able to understand line 8 and 10. Here at line 8, char* is getting typecasted as int* then again, getting typecasted as char*. Please explain. #include<stdio.h> int main() { int arr[3] = {2,3,4}; char *p; p = arr; p = (char*)((int*) (p)); … | |
The output of this code is -1, 4, 4. I am not sure about this -1. Is it because when all bits are set then in decimal it means -1 ? #include<stdio.h> int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit={1,4,4}; printf("%d %d %d",bit.bit1, bit.bit3, bit.bit4); … | |
The output of this code is char *str="char *str=%c%s%c;main(){printf(str,34,str,34);}";main(){printf(str,34,str,34);} I don't know how this is happening. Please explain. #include<stdio.h> char *str = "char *str=%c%s%c;main(){printf(str,34,str,34);}"; int main() { printf(str,34,str,34); return 1; } | |
Hello, I am not able to understand whats happening behind "ptr-p", "*ptr-arr". Please explain #include<stdio.h> int main() { static int arr[]={0,1,2,3,4}; int *p[]={arr,arr+1,arr+2,arr+3,arr+4}; int **ptr=p; ptr++; printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr); *ptr++; printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr); *++ptr; printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr); ++*ptr; printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr); return … | |
In this code at line number 7, 'p' is a 1D pointer then how come at the print statement it is being considered as 2D pointer ? and when we do 'a+1' then it would cross whole array. I am not able to understand this code. Please explain. Expected output … | |
The output of this snippet is 4 and 1. 4 is ok but why this 1 ???? #include<stdio.h> int main() { printf("%d %d",sizeof(NULL),sizeof("")); return 0; } | |
Hello,I have written this script to telnet from Ubuntu system to windows7 running system. This script goes fine upto login name, then it takes the password but it is not able to process the password. Although it looks as if the password has reached other side but in real it … | |
Hello, the output of this code is 'ef' but if we add up a "newline" print after this print then the output becomes 'efd'. Then why in earlier scenerio the 'd' was not getting printed ? Thanks in advance. #include<stdio.h> int main() { printf("\nab\bcd\ref"); } ![]() | |
Hello, This code is from "Test Your C Skills" Book. In the book they have mentioned that this code won't work, and thats true. But I am not able to understand, why its not working. Please explain why it gives error. #include<stdio.h> #define SWAP(a,b,c) c t;t=a;a=b;b=t; int main() { float … | |
Hello......I have written a script in which I am telnetting from system1 to system2. There from system2 I am doing ssh to system3. This system3 is a Embedded Board running Linux. Here on system3 I am executing a code that gives me a CLI interface. In this CLI we have … | |
Hello, I need to write a python script for performing telnet between two windows machine, that is Host and Client. After doing Telnet Successfully I need to run some application on other machine and there in that application I need to give commands via my script aswell after giving command … | |
Hi, this code is compiling successfully, but giving "segmentation fault" when I am trying to copy data to shared memory. Please tell me where I am wrong. Thanks a lot............ #include<stdio.h> #include<sys/ipc.h> #include<sys/shm.h> #include<sys/types.h> #include<unistd.h> #include<stdlib.h> #include<errno.h> #include<string.h> int main() { int id=-1, status=-1; char *check=NULL; char *p="you"; const size_t … | |
Hi, can anyone please tell me how to create a array of 20 crore (200000000) elements. I tried, but getting runtime error, might be that much memory is not available. Thanks | |
Re: Do you know "this" things name ? If yes then use name else use the name of web where it redirects you. In Mozilla go to address bar type "about:config" Search for that name or web, Reset Everything | |
Re: what do you expect from your code and what its producing ?? be specific. | |
Re: Hi! rubberman, can you please explain what was the cause of error in original code. Thanks | |
Re: int main() { char p[25]; printf("Hello world!\n"); scanf("%s",p); printf("%s\n",p); return 0; } Or #include <stdio.h> #include <stdlib.h> int main() { char *p=NULL; p=malloc(10); printf("Hello world!\n"); scanf("%s",p); printf("%s\n",p); return 0; } Or #include <stdio.h> #include <stdlib.h> int main() { char *p=NULL; p=malloc(10); printf("Hello world!\n"); gets(p); printf("%s\n",p); return 0; } | |
Re: Segmentation fault and SIGSEGV signal are generated due to unauthorised memeory access, check in your code do you need to assign memory for something | |
Re: Do your homework yourself. Atleast try and write somecode, then will help you to rectify. | |
Re: you haven't declared int z + hasn't assigned anything to it ;) Better you take user input in the function display() and in prototype set its parameters as void. All your "if" Blocks are wrong, check your parantheses. better use if, elseif, else | |
This code is crashing, please tell me for what all I need to assign memory. Thanks #include<stdio.h> #include<conio.h> #include<stdlib.h> struct s1 { char *p1; }; struct s2 { struct s1 *p2; }; struct s3 { struct s2 *p3; }*p4=NULL; int main() { char a='a'; p4=malloc(sizeof(struct s3)); p4->p3->p2->p1=&a; printf("%c",*(p4->p3->p2->p1)); return 0; … | |
The output is 2011. Can anyone plz tell me how it is so ????[CODE=c]#include<stdio.h> #include<conio.h> void main() { char c[]="GATE2011"; char *p=c; clrscr(); printf("%s",p+p[3]-p[1]); getch(); }[/CODE] | |
The output of this code is "hhe!". Upto "hhe" I can figure out what is happening but, where does this "!" came from? ASCII value of "!" is 33 and here I don't think we are anyhow getting this value. Thanks in advance[CODE=c]#include<stdio.h> #include<conio.h> void main() { static char s[25]="The … | |
The output of this code is "lice ice ce e". Seems to be string array is acting like a circular array. But how is it possible ???? [CODE=c]#include<stdio.h> #include<conio.h> void main() { int i,n; char *x="Alice"; clrscr(); n=strlen(x); *x=x[n]; for(i=0;i<n;i++) { printf("%s ",x); x++; } getch(); }[/CODE] | |
Why Does this code Leads to Infinite Loop????? [CODE=c]#include<stdio.h> #include<conio.h> int reverse(int); void main() { int no=5; reverse(no); getch(); } int reverse(int no) { if(no==0) { return 0; } else { printf("%d",no); } reverse(no--); }[/CODE] | |
Could anyone please tell me whats happenning in line number 10 and 12. The output of this code is 2 and 0. [CODE=c]#include<stdio.h> #include<conio.h> void main() { int arr[3]={2,3,4}; char *p; clrscr(); p=arr; p=(char*)((int*)(p)); printf("%d\n",*p); p=(int*)(p+1); printf("%d",*p); getch(); }[/CODE] | |
The result of this code is 65535 But I believe that for && both sides must hold true (rather one side being true is enough for ||) so how come the result is 65535 ????? when after 5++ the first condition becomes false ????? Thanks in advance [CODE=c]#include<stdio.h> #include<conio.h> void … | |
Hi, in the below given program the answer is 1. agpur 2. jabalpur 3. jabalpur I understood the processing for the first two printf statements but for the last printf statement I could not understand the processing. Could anyone please explain. Thanks in advance :) [code=c]#include<stdio.h> #include<conio.h> void main() { … | |
This is a piece of code from some book. According to book, this code must not have worked and should have given a error message saying "cannot convert parameter 1 from 'const char[15]' to 'char*'" but this code is running on turbo C giving just a error message of const … | |
Can you please tell me how is the processing of this code taking place. Because its giving a fixed address same as mentioned in the book. The Answer to this question is Address of i=FFE4 value at ptr =10 Address of j=FFE2 value at prt=20 how come addresses are these, … | |
This is a question from some book. When u run it u would get base address of the arguments provided that is, if u write in CMD "myprog one two three" then the address would be like 65521 n 65525 n 65529 Means equal byte consumption by all the arguments. … | |
can anyone please tell me whats actually happening in this code. Seems to be as if incremented pointer is pointing to the next bit of same int. Answer is 2,0 Thanks in advance [code=c] #include<stdio.h> #include<conio.h> void main() { int arr[3]={2,3,4}; char *p; p=arr; p(char*)((int *)(p)); printf("%d",*p); p=(int*)(p+1); printf("%d",*p); getch(); … | |
Here the val should print the max number but its printing some address. When i tried to print while in loop, it printed the largest number but in the next line it again printed the address. please tell me whats wrong. Thanks [code=c]#include<stdio.h> #include<conio.h> int main() { int arr[5][5]={ 2,4,8,11,15, … | |
ITS NOT MY HOME WORK I m Just Keen to do it. I don't want you to give me the code. I just want you to tell me how to access VDU and directly change character on same screen. The screen is divided into 25 rows and 80 columns. The … | |
could you please tell me whats happening at line number 8 because, the output is 3,2,30. How can the value be incremented twice with just one increment. Thanks ! [code=c]#include<stdio.h> #include<conio.h> int main() { int b[5]={10,1,30,40,50}; int j,i,k=1,m; i=++b[1]; j=b[1]++; m=b[i++]; printf("%d %d %d",i,j,m); getch(); } [/code] | |
I m trying to print the prime numbers using Sieve of Eratosthenes But, my output is 0 for all. please tell me where i m wrong. Thanks for help [code=c]#include<stdio.h> #include<conio.h> int main() { int arr[100],i,j=1,val=0,mod,num=0,k,l; for(i=0;i<100;i++) { arr[i]=j; j++; // printf("\n %d",arr[i]); } for(k=1;k<100;k++) // checking number and replacing … | |
I have written this code for insertion sort but, its not generating any output. could you please tell me whats wrong in this code Thanks!! [code=c]#include<stdio.h> #include<conio.h> int main() { int arr[25]={1,2,3,4,5,6,7,8,9,21,15,16,18,22,24,72,77,79,91,62,27,35,11,90,110},i,temp=0,j,a; int *p; for(i=0;i<25;i++) { if (arr[i]>arr[i+1]) { temp=arr[i]; arr[i]=arr[i+1]; arr[i+1]=temp; p=&arr[i]; while(i!=0) { if(*p<arr[i-1]) { temp=*p; *p=arr[i-1]; arr[i-1]=temp; … | |
This code is runnig perfectly for values perfectly divisible by 2, that is 2,4,8 But the i is not incrementing when values are given such as 7,5 could u plz tell me the error Thanks [code=c]#include<stdio.h> #include<conio.h> int fun(int); int main() { int num; float mod,prime,m; printf("enter the num"); scanf("%d",&num); … | |
In this code compiler says "type mismatch" in function. There are two diff data type in function one int and one Float. Is it possible to use two diff values or i need to take both of same type. plz rply Thanks [code=c] #include<stdio.h> #include<conio.h> void main() { int a; … | |
At line 12 compiler gives error....`float*' to `float' for argument `6' to `int fun(int, int, int, int, int, float, float)' could anyone plz tell me, where i m wrong......... Thanks [code=c]#include<stdio.h> #include<conio.h> int fun(int,int,int,int,int,float,float); int main() { int a1,a2,a3,a4,a5; float avg=0.0,sum=0.0; printf("Enter the five values"); scanf("%d %d %d %d %d",&a1,&a2,&a3,&a4,&a5); … | |
When i am trying to run a C program in Eclipse, it gives error. Saying, "launch failed, Binary Not found" Could anyone plz tell me how to put in Binaries into Eclipse........ | |
Below shown is a simple C Code. The code which is troubling is in commented area (please remove comment symbol to run those lines, comment symbl is just here to highlight them), here there are two printf's in comment area......... the error is that both are getting executed continuously without … | |
Hiiiiiiiiiiii!!!!!!!!!........... The program written below runs perfectly upto some extent but the output varies............because the compiler prints the "{Enter the value}" line twice and itself adds a positive number in the counter.................. [code=c] #include<stdio.h> #include<conio.h> int main() { int sum1=0,sum2=0,sum3=0; char value,alpha; while(alpha!='D') { printf("\n Enter the value"); scanf("%c",&alpha); if(alpha==0) … |
The End.