15,552 Topics

Member Avatar for
Member Avatar for vgd

[B][/B]char c "GATE2011"; char *p =c; printf "%s", p+p 3 p 1 ;   = [B][/B] the output is 2011 can any one explain how?

Member Avatar for smilenow
0
143
Member Avatar for vikaasgoel.007

Hey Similar doubt. Hers is the code snippet.. [CODE]typedef struct { char v; struct node *next; }node; void make_it(node a, char ch); int main() { int i,n=10; char ch[2]; node *a=(node *)malloc(n*sizeof(node)); a[i].v=i+65; a[i].next=NULL; scanf("%s",ch); make_it(a[i],ch[0]); return 0; } void make_it(node a, char c) { node *ptr,*p; ptr=(node *)malloc(sizeof(node)); ptr->v=c; …

Member Avatar for Narue
0
151
Member Avatar for nanao

Could you please help me on this. i tried but i am getting segmantation fault. void qsort(char *v[], int left, int right){ int i, last; void swap(char *v[],int i,int j); if(left>=right) return ; swap(v,left,(left+right)/2); last = left; for(i=left+1;i<=right;i++) if(strcmp(v,v)<0) swap(v,++last,i); swap(v,left,last); qsort(v,left,last-1); qsort(v,last+1,right); } void swap(char *v[],int i,int j){ '... …

Member Avatar for TrustyTony
0
312
Member Avatar for Despairy

i studied c++ before c guess that was my mistake... i try to read from a file a set of strings and put them in the new allocated array, i do not understand what is the main thing this code isnt working. i get segmentation fault... and even trying to …

Member Avatar for Narue
0
2K
Member Avatar for meli1

Heya i ran into a little problem, well more of a mental dilemma using strtok(), i already know how this function works, heres an example code: [CODE] void split_me(char *input) { char *split = NULL; //reset split size_t len = strlen(input); char to_array[len]; int i = 0; split = strtok(input, …

Member Avatar for meli1
0
140
Member Avatar for venus87

[CODE] #include<stdio.h> #include<conio.h> void main() { int a; a=10, // in this line instead of ; i used , printf(" The value of a is =%d", a); getch(); } [/CODE] In the above program instead of using ; i used , but the compiler is not showing any error and …

Member Avatar for Ancient Dragon
0
177
Member Avatar for Daniel85

***I have a feeling that there might be something wrong with my function int fgetAnswers(int*pos, char res[], FILE*inp); I am able to compile, but the problem is that wherever the black screen appears, a box would pop out saying that the program has stopped working. Can any of you guys …

Member Avatar for Daniel85
0
162
Member Avatar for Daniel85

Is there anything wrong with my coding? Why do I keep getting the message..."Error Opening Input File!" #include <stdio.h> #include <conio.h> void fgetAnswers(FILE*,int*,char[]); void fgetAnswers2(FILE*,int*,int,char[]); int main() {char ans[50],choices[50]; int n,i,id,missed[50],tot; FILE *input,*output; input = fopen("examdat.txt","r"); if(input == NULL) { printf("Error opening input file!\n"); getch(); return 0; } fgetAnswers(input,&n,ans); output …

Member Avatar for Daniel85
0
223
Member Avatar for hszforu

I am using turbo c. I have a 2mb text file "tryy.txt" , so what i am trying to do is ,i am scarping the urls from the text file and saving it into another file. Now, after running the program, i get a meassage as "Null Pointer Assignment" on …

Member Avatar for WaltP
0
101
Member Avatar for lilsancho

Hi Everyone Hope you are all well. I've been tasked with an assignment at collage to create an employee management system, so far i've done well and managed to create a working program which i am happy with :) However there is an optional function that can be created that …

Member Avatar for lilsancho
0
160
Member Avatar for Radi0ShacK

Hi all, I just wanna know how to send a file through a socket connection in C language "client request a certaion file on server and server send him this file" i work on both winsockets and bsd sockets "client ==> windows, server ==> *nix" Thanks alot :)

Member Avatar for MaSSaSLaYeR
0
491
Member Avatar for ArmanUV

I am buiding a Tic Tac Toe solving robot using the LEGO NXT kit for my school project. For practise, I wrote a Tic Tac Toe game using the minimax algorithm which worked very well. When I wanted to port my code to NXT, I found out that none of …

Member Avatar for Adak
0
1K
Member Avatar for MemphameHeroic

I need help in making a C program that performs binary operations on two 16 bit binary values. It should look like this: Select operation (1) Addition (2)Subtraction Enter Choice: 1 Enter First binary number: 1111111111111110 Enter Second binary number: 0000000000000001 Sum: 1111111111111111 I have trouble using the functions, please …

Member Avatar for Adak
0
239
Member Avatar for akde

I have created a new C++ project (to be able to use the graphics.h library) then I have tried to add a C project which works perfectly in C (by the way I have saved the file with .c extension). 2 line leads to error: [CODE] q = malloc(sizeof(struct QueueRecord)); …

Member Avatar for akde
0
259
Member Avatar for janet@123

i am receiving a struct from the switch: [CODE]/* Packet received on port (datapath -> controller). */ struct ofp_packet_in { struct ofp_header header; uint32_t buffer_id; /* ID assigned by datapath. */ uint16_t total_len; /* Full length of frame. */ uint16_t in_port; /* Port on which frame was received. */ uint8_t …

Member Avatar for janet@123
0
267
Member Avatar for CityThrille

Good day everyone. I am back from some previous months of extensive schoolwork. I am creating now a payroll application, but I think there's something wrong in my code, because it created an output that's not my intended output. Wait, guys, I'm confused. Is this appropriate for a C forum …

Member Avatar for CityThrille
0
296
Member Avatar for pnoylover

can anyone help me get an idea on how to add or subtract numbers in linked list for example i input the number 1,3,5 in order the display will 135 then i input the plus sign(+) then the input will 45 it will always add the 1st and 2nd number …

0
60
Member Avatar for amnakhan786

i am writing a code which is as follows: [CODE]#include <stdio.h> int main(void) { char buffer[2500]; FILE * myfile; myfile = fopen("/home/csgrads/akhan015/desktop/benchmark/coverage/test0/stmt.txt","r"); while (!feof(myfile)) { fgets(buffer,2500,myfile); printf("%s",buffer); } fclose(myfile); return 0; }[/CODE] 1.in this code i am accessing a folder to read a text file. this test0 folder is only …

Member Avatar for Rashakil Fol
0
184
Member Avatar for coding101

Im having trouble connecting my sockets. On one computer I have a java server socket running and on the other computer i have a c socket client trying to get the message from the other computers server. But I cant get them to connect. Do you see an error with …

Member Avatar for nezachem
0
146
Member Avatar for jerox

Hey guys, I am new to programming in C, I am trying to save "tc" into a variable using for loops. I understand for integers, multiply the result by 10. Is there a similar way to do this for chars? For integers, [CODE=C] for(j = 0; j < i; j++) …

Member Avatar for jerox
0
138
Member Avatar for terence193

This is what the question is asking: Write a program to get the user to enter a positive number. Validate the input so any negative or zero number entered is rejected and the user is to re-enter the number. and this is what i have done [CODE]#include<stdio.h> int main (void) …

Member Avatar for YAMNA MIDHAT
0
198
Member Avatar for pkrai

[CODE]#include<anil_pkr.h> void main() { menu();getch(); } /* header file- #include<iostream.h> #include<conio.h> #include<dos.h> #include<string.h> #include<ctype.h> #include<stdio.h> #include<stdlib.h> ////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// int i,j,k,l,x=5,y=5; char n; void smallbox(int,int,int,int,int); void smallbox(int col,int x,int y,int len,int brth) {textcolor(col); gotoxy(x,y+brth);cprintf("%c",192); for(i=1;i<len;i++){gotoxy(i+x,y);cprintf("%c",196);} for(i=1;i<len;i++){gotoxy(i+x,brth+y);cprintf("%c",196);} gotoxy(len+x,y);cprintf("%c",191);gotoxy(len+x,brth+y);cprintf("%c",217); for(i=1;i<brth;i++){gotoxy(x,y+i);cprintf("%c",179);} for(i=1;i<brth;i++){gotoxy(len+x,y+i);cprintf("%c",179);} gotoxy(x,y);cprintf("%c",218); } /////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// void paint(); void paint() { for(i=1;i<75;i++){textbackground(15); gotoxy(3+i,19);cprintf(" "); …

Member Avatar for Ancient Dragon
0
120
Member Avatar for abshah

Hi, I am facing a bit of issue in writing a network software. When I try to send or receive a struct that contains a data type of 8 bytes the next sent or received struct is somehow affected. I have a few things in mind but first I wanted …

Member Avatar for abshah
0
473
Member Avatar for gnomelook

Help!! How to print this using loop & condition starements... 0 1 1 1 1 -1 0 1 1 1 -1 -1 0 1 1 -1 -1 -1 0 1 -1 -1 -1 -1 0 help pls..asap...

Member Avatar for gnomelook
0
134
Member Avatar for libathos

Is there a way i can modify the Bresenham circle algorythm in a way so that it actually draws arcs with specified start and end angle instead of complete circles? the algorythm in c is like this [CODE]void DrawCircle(int xM,int yM,int radius) { int f = 1 - radius; int …

Member Avatar for Adak
0
191
Member Avatar for lscamaro

I'm writing a pig latin program and am having problems moving onto the next word and printing the words. I have to print from the first vowel onto the end of the word and then from the beginning of the word to the first vowel including the vowel itself. [CODE]#include …

Member Avatar for YourGamerMom
0
488
Member Avatar for amnakhan786

description of the program: 1. first i have to input a folder A by giving full filepath. this folder contains a benchmark program tcas.c, a text file universe.txt which contains 1500 lines, each line is a test case giving 12 arguments to the benchmark program, which are used to test …

0
132
Member Avatar for collinskawere

how can i create something of this sort: * *** ***** ******* ********* ******* ***** *** * this is my source code: #include <stdio.h> int main() { int i; i = 1; while(i <= 5) { printf("*\n"); i++; } getchar(); }

Member Avatar for collinskawere
0
167
Member Avatar for ram619

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 …

Member Avatar for ram619
0
193
Member Avatar for timetraveller92

This code is done using C. Whole point of it is to remove the name just before the first hyphen. Its blindly written so I haven't improved it and it has extra variables and no reuse of variables to save space. If anyone can just locate the error why the …

0
137

The End.