Posts
 
Reputation
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
~38.8K People Reached
Favorite Forums
Favorite Tags
Member Avatar for ~s.o.s~

EDIT: Please note, as I write this, the post is now 6 years old and might have some outdated information. I'd personally recommend beginners start with "Learn C the hard way" by Zed and this book since I have heard good things about them. Reading the FAQ put together by …

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
149
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
173
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
636
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
204
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
107
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
124
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
128
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
163
Member Avatar for Esmerelda
Member Avatar for andrewpw

[CODE=c]int OperateGumBallMachine(void){ int total = 0; char input = getchar(); RefillGumBallMachine(); for(input; input != 'x'; input = getchar()){ if(gMachine.iNumBlueGumBalls + gMachine.iNumGreenGumBalls + gMachine.iNumRedGumBalls == 0){ RefillGumBallMachine(); } switch(input){ case 'n': total += NICKLE; if(total >= QUARTER){ total -= QUARTER; DeliverGumBall(); printf("Your change is %d cents\n", total); total = 0; } …

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
141
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
99
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
186
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
176
Member Avatar for Fixxxer

Hi there I have written the following code to read some data from a file and bin the data into bins of equal size so I can plot this data easily. [CODE]#include <stdio.h> #define N_HITS 1800 #define N_TIME_BINS 78 int main() { int i, time_bins[N_TIME_BINS],j; double event; double hit[N_HITS],value; FILE …

Member Avatar for Gaiety
0
216
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
118
Member Avatar for Jaks_maths

Returns the largest sum of contiguous integers in the array Example: if the input is (-1, 2, -3, 2, 0, 5, -11), the largest sum is 7 Time complexity is O(n).

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
144
Member Avatar for tejaspandey

[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.

Member Avatar for Gaiety
0
145
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
152
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
180
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
181
Member Avatar for needhelpe
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
176
Member Avatar for fedya
Member Avatar for uday jha
0
595
Member Avatar for nick22

I am very much a beginner and trying to create a linked list, asking the "user" to input 5 or 6 values. My problem is that I don't know the correct terminology or how to store the user's input so that I can create my pointer to the next value …

Member Avatar for WaltP
0
971
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
72