Posts
 
Reputation
Loading chart. Please wait.
Joined
Last Seen
Ranked #4K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
58% Quality Score
Upvotes Received
9
Posts with Upvotes
9
Upvoting Members
9
Downvotes Received
7
Posts with Downvotes
7
Downvoting Members
6
2 Commented Posts
~39.7K People Reached
Favorite Forums
Favorite Tags

78 Posted Topics

Member Avatar for ~s.o.s~

[QUOTE=~s.o.s~;234971]Based on the request by Mr. Jamshid i thought why not just start the useful links and tutorials for novice C programmers so they dont have to do a lot of GOOGLE like the one present in Python Forums. If the moderators like the concept here they can sticky this …

Member Avatar for mack1
29
5K
Member Avatar for Gaiety

Hi, When i debug the program using gdb , the gdb is entering the definations of std lib functions (ex: printf, strcpy ect) and other internal functions. Initially the debuger was working fine, i dont have clue when it got changed.I guess some of the flags of gdb might have …

Member Avatar for Gaiety
0
1K
Member Avatar for Gaiety

Hi , I am trying for a program which takes any no of characters as input and stores, so obviously i would need DMA. My approch is to Take a buffer of some fixed size(5 in this case) Fill the buffer till the fixedsize-1 Allocate memory dynamically and store the …

Member Avatar for Gaiety
0
152
Member Avatar for Gaiety

hi, i have seen somany people asking about fnding loops in a single linked list. i would like to know is there any advantange or necessity for having loops in a linked lists. is there any application that really requires loops in lists. Thanks, Gaiety

Member Avatar for rubberman
0
176
Member Avatar for Gaiety

I have some strange problem which i started facing from yesterday. i have used GDB many times on my system , but yesterday when i started running GDB , my dubugger is enterings the library functions code part also which is very irritating for me. I mean if the program …

Member Avatar for _avishek
0
642
Member Avatar for Gaiety

I have executed the below program several times, most of the time i got the same out put but some times output is different. sample out put is: > skylab@skylab:~/Nx/Thrds$ gcc 3.c -lpthread > skylab@skylab:~/Nx/Thrds$ ./a.out > Scheduling policy = ??? > arg = 20 > 1arg = 20 > …

Member Avatar for Gaiety
0
215
Member Avatar for Gaiety

Hi, Can somebody please explain , printing with structure variable also working. int main( void ) { struct bitfs { unsigned char a:4; unsigned int b:5; }; struct bitfs bf = {15,31}; struct bitfs2 { unsigned char a:4; unsigned int b:5; }bf2 = {15,31}; printf("a= %u \n", bf.a); printf("b= %u …

Member Avatar for WaltP
0
110
Member Avatar for Gaiety

Hi, I know i am asking a question which can be googled and find lot of explanation. I have actually gone through many but none explained the ownership property completely. > Mutex is acquired by some process, only that process can unlock it how the other process/thread know that the …

Member Avatar for mike_2000_17
0
128
Member Avatar for Gaiety

Hi, I have added sleep with random timings and printed the values. I am actually expecting the "Blocked in Child" OR "Blocked in Parent" out put when other process sleeps. But it it never printing the statement.(when the process is going to sleep the semaphore is not cleared so i …

Member Avatar for Banfa
0
133
Member Avatar for Gaiety

Hi All, I have read that the system call "execlp" will take the first arguement as the file name(or path), second arguement as the command and all others are arguements to the command terminated by NULL. i have written below program. [CODE] #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> …

Member Avatar for Gaiety
0
167
Member Avatar for Esmerelda

The value of a is used after it is incremented twice ie 7. but such expression behaviours are not defined by standards. [url]http://c-faq.com/expr/ieqiplusplus.html[/url]

Member Avatar for WaltP
0
295
Member Avatar for andrewpw

The simplest i can think is to include the below [CODE] for(input;input!='x';input=getchar()) { if (!isspace(input)){ switch(input) { ...... ...... } } } [/CODE]

Member Avatar for Gaiety
0
3K
Member Avatar for Gaiety

Hi, I want to print the word that start with h(not case sensitive). i tried with below code but its printing only one charater 'H'. i dont understand the metacharaters and regular expressions much. i understood that $1 will have the first match and $2 will have second match and …

Member Avatar for Gaiety
0
152
Member Avatar for Gaiety

Hi, I have just started learning PERL. below is the code i have written , i am expecting the same order that of array when i print the contents. but the output was [ICODE] 29 25 Michael 29 Walter 34 Donny 25 Sobzchak 30 [/ICODE] can some body please clarify …

Member Avatar for Gaiety
0
103
Member Avatar for Gaiety

Hi , what is the behaviour of below pseudo code. [CODE] pipe(fd) if(fork()){ read(fd[0]); } else { write(fd[1]); write(fd[1]); } [/CODE] I understand how system calls work , but could not understand the behaviour when used differently. secondly if a process uses while(1); in side its block, will the entire …

Member Avatar for Gaiety
0
187
Member Avatar for Gaiety

I have created few files and Makefile in the same place. I have read in below link about the special variables $@ and $< and used as so. [URL="http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/"]http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/[/URL] but when the say make i keep getting the error [ICODE]gcc -o calc *.o /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function `_start': (.text+0x18): undefined reference …

Member Avatar for Gaiety
0
184
Member Avatar for Fixxxer

[CODE][/CODE][CODE]fscanf(fp,"%lf\n", event); [/CODE] requires address of variable so use [CODE]fscanf(fp,"%lf\n", &event); [/CODE] lly, [CODE]fprintf(fw, "%d\n" , &time_bins[j]);[/CODE] does not need address to print [CODE]fprintf(fw, "%d\n" , time_bins[j]);[/CODE] is sufficient.

Member Avatar for Gaiety
0
243
Member Avatar for Gaiety

[CODE] #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main( void ) { int fd,nob; char str[1024]; fd = open("test.txt",O_RDWR|O_CREAT,S_IRWXU); if (fd < 0) { perror("open:"); exit(0); } nob = write(fd,"hello first",1024); close(fd); printf(" %d nob written",nob); fd = open("test.txt",O_RDWR); nob = read(fd,str,1024); close(fd); printf(" %d nob …

Member Avatar for Gaiety
0
124
Member Avatar for Jaks_maths

what is the meaning of largest sum of contiguous integers. i understood it as below. ( correct me if wrong ) consider the elements of the array are -1, 2, -3, 2, 0, 5, -11 so the sums of contiguous elements will be [ICODE] (-1) + 2 + (-3) + …

Member Avatar for mariola
-1
1K
Member Avatar for Gaiety

Hi, I just started unix programming . below are the two files i am using for reading/ writing from/to a named pipe called RNP. read.c is run on one terminal and write.c is run on other terminal. write.c is accepting the input , but read.c is not reading the input …

Member Avatar for Gaiety
0
146
Member Avatar for tejaspandey

[QUOTE=tejaspandey;1722398][CODE] #include <stdio.h> #include <stdlib.h> int main() { FILE *fp; char ch; fp=fopen("exp.txt","w"); while( (ch=getchar()) !=EOF) { putc(ch,fp); } fclose(fp); return 0; } [/CODE] I am using gcc compiler in linux mint This code is not working only exp.txt is created which is empty.[/QUOTE] your program is correct , just …

Member Avatar for Gaiety
0
148
Member Avatar for Gaiety

Hi, I have recently gone through some C internal stuff, addressing schemes(logical,relocatable and physical). what i dint get here is how are these inter-related.I do understand that these three are genearated by different tools. I want to know how exactly one is useful for other in executing the program in …

Member Avatar for Gaiety
0
160
Member Avatar for Gaiety

Hello , i have read the manual page of alloca , it is documented there that "alloca works similar to the malloc but it allocates memory from stack and frees automatically. i can't get how can i use that in a program . if i'm not wrong can i use …

Member Avatar for monishch
0
187
Member Avatar for Gaiety

Hi, if any one has any idea "how the switch statement works". does it maintain any tables internally or any other machanism? and is there any way to make the switch statement efficient?

Member Avatar for lyfzopen
0
189
Member Avatar for needhelpe

[QUOTE=needhelpe;1016179]how can I output 123454321, if i input 5. and 1234321 if i input 4?[/QUOTE] you could do that by following below read count; [CODE]for(start = 1; start <= conut; start++) putchar( start + '0' ); for(start = start -2; start > 0; start--) putchar( start + '0' );[/CODE]

Member Avatar for Nick Evan
0
4K
Member Avatar for Gaiety

below is the code for traversing a binary tree without using recursion but the problem with the code is we require array of pointers to store all the nodes address. in below program the parameter nodes in the function push is an array of pointers to store all the node …

Member Avatar for jl.lakhnai
0
179
Member Avatar for fedya

[QUOTE=Narue;1063789][B]>Can someone explain me what does this mean? >"40[^\"], %*c"[/B] Assuming it's actually "%40[^\"], %*c", it means read a string of up to 40 characters or until a double quote is found (%40[^\"]), then match a comma, any amount of whitespace, and ignore the next non-whitespace character (%*c). The %[ …

Member Avatar for uday jha
0
612
Member Avatar for nick22

specify the requirements clearly : what do you want to store in linked list numbers or names(strings). if numbers are to be stored use scanf else use fgets or you can define one safe function for reading strings. post your program here so that you will get some guidelines on …

Member Avatar for WaltP
0
1K
Member Avatar for Gaiety

[CODE]/* Function to find prime number if so return 1 else return 0 */ #include<stdio.h> #include<math.h> int isprime( int num ) { int i ; int sq = ( int ) sqrt ( num ); /* here check should be done for num = 0 and 1 other wise 0 …

Member Avatar for Gaiety
0
2K
Member Avatar for Gaiety

i am clear with the concept of Array of pointers & pointer to an Array. but i wonder what is the advantage of creating a pointer to an array though the same can be done just by using twod array with row and col indexes. please some let provide me …

Member Avatar for Ancient Dragon
0
75
Member Avatar for Gaiety

Is there any problem with the code . Why this code is generating all offsets as 28. [CODE] #include<stdlib.h> #define offsetof( T , M ) (( size_t )(( char *)&(( T *)0) ->r - \ (char *)(T *) 0)) int main(void) { struct STU { char name[20]; struct DATE { …

Member Avatar for Gaiety
0
100
Member Avatar for Gaiety

[CODE] #include<ncurses.h> int main() { WINDOW *win ; initscr(); win = newwin(10,30,10,10); box( win, ACS_VLINE, ACS_HLINE); refresh(); wrefresh(win); mvwprintw(win , 13, 14, "Enter any Key :\n "); refresh(); wrefresh(win); getch(); refresh(); wrefresh(win); endwin(); printf("END"); return 0; } [/CODE] I just started learning Ncurses and have some questions: i understand that …

Member Avatar for Gaiety
0
152
Member Avatar for Gaiety

why we have an int type when we already have short and long ints because int means either short or long.

Member Avatar for Salem
0
154
Member Avatar for Gaiety

I am writing a program to create a window and a box in which the statements are printed but i am unable to get the correct out put. some times after executing the program its showing the commad line but what ever the commands i enter are not visible at …

Member Avatar for Salem
0
132
Member Avatar for chet6

[QUOTE=chet6;1041613]Hi, Could anyone please explain how the memory allocatio is done in case of double pointers?[/QUOTE] int var = 10 ; int *pvar = &var; int **ppvar = &pvar; here [ICODE]var[/ICODE] is 10. and this will be stored in some memory say that is 1000 (i.e &var =1000) so var …

Member Avatar for manutm
1
137
Member Avatar for cutedipti

[QUOTE]Please tell me how will be the correct program to get correct output[/QUOTE] where is your program-------->

Member Avatar for Gaiety
0
97
Member Avatar for Iam3R

[QUOTE=Aia;1026854]Take a look at its prototype. What type does getch() return?[/QUOTE] int getch(void); returns an integer value so whats the problem, atleast it should print some value.

Member Avatar for Tom Gunn
0
996
Member Avatar for theprofoundgeek

[CODE] for (counter1=0;counter1<row;counter1++) { *(ptrA+counter1)=(int*)(calloc(column,sizeof(int))); *(ptrB+counter1)=(int*)(calloc(column,sizeof(int))); *(ptrC+counter1)=(int*)(calloc(column,sizeof(int))); } [/CODE] (i) why are you allocating memory for ptrB and ptrC. you are not using them at all. (ii) [CODE] scanf("%d",**((ptrA+counter1)+counter2));[/CODE] is wrong, it should be [CODE]scanf("%d",&(**((ptrA+counter1)+counter2)));[/CODE] if you want to allocate memory for two D array. you can do it simply …

Member Avatar for Gaiety
0
155
Member Avatar for kapiljain469

A linked list is a data structure in which it contains the nodes. a node is a structure it contains the data field and a pointer field. the data field can be anything, and the pointer field contains the address of the next node. so the structure should be struct …

Member Avatar for paradip
0
128
Member Avatar for cjjack88

you are reading the file in wrong order here is a sample [CODE] void read() { FILE *fp; int x; char t1[50],t2[50]; float f1,f2; fp=fopen("read.txt","r"); if(fp) { while((x=fscanf(fp,"%s%f%s%f",t1,&f1,t2,&f2))!=EOF) { printf("x=%d\n",x); printf("%s\n %f\n %s\n %f\n",t1,f1,t2,f2); getchar(); } printf("END x=%d\n",x); } else printf("File open failed\n"); fclose(fp); } [/CODE]

Member Avatar for cjjack88
0
90
Member Avatar for its.avinash

function to display the floating number the float numbers are stored in sign exponent mantissa fashion furthur reading http://steve.hollasch.net/cgindex/coding/ieeefloat.html void test() { float f=5.25; char *p=(char *)&f; int i; for(i = 3; i >= 0; i-- ) printf("%x\n",p[i]); } refer the attachment for out put on my system .

Member Avatar for Gaiety
0
139
Member Avatar for thebluestar

I think this will do.. [CODE] int main() { int a[10]={12,15,19,27,20,31,45,54,59,90}; //int a[10]={1,2,3,3,5,6,7,8,9,10}; int flag; flag=find_order(a,sizeof(a)/sizeof(a[0])); if(flag) printf("In order\n"); else printf("Not In order\n"); return 0; } int find_order(int a[],int high) { int j; for(j=0; j<high; j++) { if(a[j]<=a[j+1]) continue; else break; } if(j==high) return 1; else return 0; }[/CODE]

Member Avatar for kvprajapati
0
6K
Member Avatar for new programer

every thing is correct except this it is always false [CODE] if (loan=0) cout << "Months to repay the loan =" << counter <<endl[/CODE] it should be [CODE] if ( loan == 0) cout << "Months to repay the loan =" << counter <<endl[/CODE] simple assignment operator makes life misearable …

Member Avatar for ithelp
0
91
Member Avatar for GARO

i dont understand your logic but here i am giiving mine. this is not so efficient but will do the same work. [CODE] #include <cstdlib> #include <iostream> #include<cstdio> using namespace std; int prime (int num); int pal(int num); void makepals(int num); int Pals[100000]; int cnt =0; int main(int argc, char …

Member Avatar for DoctorBinary
0
144
Member Avatar for jodie121997
Member Avatar for Gaiety
0
132
Member Avatar for Buffalo101

I hope this will solve your problem [URL="http://www.dreamincode.net/forums/showtopic74004.htm"]http://www.dreamincode.net/forums/showtopic74004.htm[/URL]

Member Avatar for Gaiety
0
134
Member Avatar for riahc3

[QUOTE=riahc3;1023687]Hey I have a text file (1.txt) with the lines: This is line 1 This is line 2 This is line 3 This is line 4 This is line 5 and Im trying to read all the pair lines from that file and write them to another text file called …

Member Avatar for Gaiety
0
202
Member Avatar for Gaiety

Hi, if any one has the idea of the internal system calls which gets activated by using high level statements ( like printf ,scanf or malloc and so on) please provide me the links or any related info. i have an idea that the internal system calls depends on the …

Member Avatar for Ancient Dragon
0
198
Member Avatar for mcap61

i just had a glance at your code you declared [CODE] int temp_1, temp_2, temp_3; [/CODE] and used [CODE] record.total_points = temp1; record.total_points = temp2; record.total_points = temp3; [/CODE] mismatch in variable names you must be getting compilation errors. correct the names first, and you are not updating the global …

Member Avatar for rdrast
0
116
Member Avatar for boydale1

decalre a union with one double value and char array of 8 bytes. in Little Endian format , always the sign will be MSB. so take 7th array, and perform AND operation with 1(char) left shifted 7 times. and return the resultant value. NOTE: the returned value is not 1 …

Member Avatar for yellowSnow
0
195

The End.