15,550 Topics

Member Avatar for
Member Avatar for hwoarang69

so the code is pretty simple. it just loops and if statements. first i have a main. i took the headers and prototypes out to make it smaller. In main all iam doing is asking user to enter command and call one funtion. // main.c int main(int argc, char *argv[]) …

Member Avatar for WaltP
0
185
Member Avatar for tischn

Hi i had never before used structures, so i am a complete noob ;) . this is a small Part of my programm: struct player { int var1; int var2; int var3; int var4[10]; int var5; int var6; }; struct player p[4]= {{1000,0,0,{0,0,0,0,0,0,0,0,0,0},0,1}, {1000,0,0,{0,0,0,0,0,0,0,0,0,0},0,1}, {1000,0,0,{0,0,0,0,0,0,0,0,0,0},0,1}, {1000,0,0,{0,0,0,0,0,0,0,0,0,0},0,1}}; printf("%d\n"), p[0].var1; printf("%d\n"), p[0].var2; …

Member Avatar for tischn
0
136
Member Avatar for eng_m

Hi guys. so I have been trying to solve this problem and I wrote a program but it doesn't work for some reason I would apreciate a help from you guys. The problem: A palindrome is a word, phrase, or any other sequence of letters that can be spelled the …

Member Avatar for thines01
0
108
Member Avatar for peste19

I am reviewing material i have covered in c and i wrote up some notes and i am getting an error, i was hoping if someone could help me with this #include <stdio.h> #include <stdlib.h> #include <string.h> struct node{ int data; struct node *next; }; void addtobegining(int); void traverse(); struct …

Member Avatar for wahidbashacse
0
121
Member Avatar for el33t

Hi, I am facing some problem dealing with the qsort funtion. Basically, the below program takes in a bunch of strings from the text file "word.txt" and then implements the qsort function for sorting the list alphabatically and then displaying the sorted list. However, after the sorting is done, all …

Member Avatar for el33t
0
115
Member Avatar for Lucaci Andrew

OK, so here's the deal. I'm trying to create 2 programs, a server and a client, which communicates between them. I'm working on Ubuntu, throughout FIFO. So, 1st of all, I create 2 FIFO's: $ mkfifo pipe $ mkfifo pipo Ok, and after that I create the client and the …

Member Avatar for Ancient Dragon
0
254
Member Avatar for IcyFire

I have to write a program that does BFS traversal. My code is mostly correct but i have an error somewhere. it prints repeated numbers in some cases and it's not supposed to. i'm not sure exactly what the problem is. I really hope someone will be able to help …

0
142
Member Avatar for hypernova

Hi all!! See the following code: #include <stdio.h> int main() { union a { int i; char ch[2]; }; union a u; u.ch[0]=1; u.ch[1]=0; printf("%d %d %d\n",u.ch[0],u.ch[1],u.i); getch(); return 0; } The output that I get is: 1 0 2130509825 Why am I getting this number? What I think the …

Member Avatar for hypernova
0
260
Member Avatar for The Blacklist

#include<stdio.h> #include<stdlib.h> struct student{ char *name; int number; }; struct class{ char *name; struct student *st_array; // pointer of array of students int size; // All students free places int current_size; // Occupied places }; struct student make_student(char name[100], int number){ struct student st; st.name = name; st.number = number; …

Member Avatar for TrustyTony
0
287
Member Avatar for srinidelite

Hello i was assigned for a task to find the Name and books Taken as a count from the given TWO array table , I wrote a program but it's not working , experts pls help me out!! commondata b/w the TWO ARRAY TABLES are - ID of a student …

Member Avatar for DeanMSands3
0
144
Member Avatar for hypernova

Hi all! I was experimenting a little with scanf. I am posting the code and the outputs I am having prolems understanding: #include <stdio.h> int main() { char a,b,c; int d,e; scanf("%c%c",&a,&b);//-------------------(1) printf("%c %c\n\n",a,b); scanf("%d%d",&d,&e);//-------------------(2) printf("%d %d\n\n",d,e); scanf("%c abc",&a);//--------------------(3) printf("%c\n\n",a); scanf("%c abcdefgh",&a);//---------------(4) printf("%c\n\n",a); getch(); return 0; } In (1): Doesnt …

Member Avatar for hypernova
0
298
Member Avatar for tomtetlaw

Is the first texture name returned from glGenTextures always guaranteed to be 1 for the first call in your program?

Member Avatar for DeanMSands3
0
57
Member Avatar for Junior999

#include <stdio.h> #include <stdlib.h> int main() { begin(); } int begin() { long int b,res1,res2,res3; int a,c,d,e,f,i; printf("Enter first number: "); scanf("%d",&a); printf("Enter second number: "); scanf("%ld",&b); c=b%10; d=b%100-c; e=b/100; res1=a*c; res2=a*d; res3=a*e; f=a*b; printf("\n\n\n"); printf(" %d\n",a); printf("x\n"); printf(" %d\n",b); printf("________\n"); printf(" %ld\n",res1); printf("+ %ld\n",res2); printf(" %ld\n",res3); printf("_______\n"); printf("%d\n",f); system("PAUSE"); …

Member Avatar for deceptikon
0
103
Member Avatar for luvrahul30

Please Tell me how to scan a source file in c..suppose a file i am giving as input and i have to scan that files for different things...can anybody help me!!!!!

Member Avatar for deceptikon
0
116
Member Avatar for hwoarang69

warning: int format, pointer arg (arg 2) i have no pointers this function :( main.. functions.... functions. int test(char num) { int total[SIZE]; printf("%d",total); fflush(stdout); //no pointers return 0; }

Member Avatar for deceptikon
0
233
Member Avatar for MastAvalons

Hi, my project works with emulating the file system. I can invent my own as well. I'm developing a unix like shell which will provide all the file handling commands similar to unix. Basically I want to allocate a large file on the actual file system, and treat it as …

Member Avatar for MastAvalons
0
190
Member Avatar for khoo_jun

i have problem that the the loop to check if a digit is correct but not at the right place. then print. void feedback( char random[4], char guess[5]) { int i; for(i=0; i<4; i++) { if(guess[i]==random[i]) { printf("#"); } } if((guess[0]==random[1]||guess[0]==random[2]||guess[0]==random[3])&&guess[0]!=random[0]) { printf("*"); } if((guess[1]==random[0]||guess[1]==random[2]||guess[1]==random[3])&&guess[1]!=random[1]) { printf("*"); } if((guess[2]==random[0]||guess[2]==random[1]||guess[2]==random[3])&&guess[2]!=random[2]) { …

Member Avatar for WaltP
0
187
Member Avatar for el33t

Hi, I created a C program which basically calculates bunch of variable values.... Although the desired output for the final version program is just a few lines, however, for debugging purpose, I've printed the variable values everytime a change is being made in-code. As a result, the output consist of …

Member Avatar for el33t
0
234
Member Avatar for hwoarang69

i need help with if statement. for some reason its not working right and i dont know why. i never goesinside 2nd if statement. i i want to go inside this if statement - if left_var value is "2x" //for loop iam start with x. b = 'x' and b-1 …

Member Avatar for scudzilla
0
122
Member Avatar for stephenhawkings

Hi, i want to read each of the 4 columns stored in a .txt file separated by a space into an array of their own. The text file may have hundreds of rows so reading until the end of file is desirable. Example: 3.4407280e+003 6.0117545e+003 8.0132664e+002 2.5292922e+003 3.4163843e+003 5.9879421e+003 7.7792044e+002 …

Member Avatar for Ancient Dragon
0
244
Member Avatar for TarkiB

Hi there, As the title says, I'm having an issue passing an array of structures to a function.The structure reads and tokenises information from a text file. I then need to do things with that data using several different functions. Here's my code: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef …

Member Avatar for TarkiB
0
3K
Member Avatar for hwoarang69

lets say i have a i have a char array char left_var[] //-33x-4x+x this char left_var array has the value of "-33x- 4x+ x" and result should be "-33-4+1" and store in another array called in another word iam trying to get rid of x's and if there is only …

Member Avatar for hwoarang69
0
144
Member Avatar for NitaB

Well, it's been a lonngg time since I've last been on DaniWeb and everything looks different. Anyway, I'm having a bit of a brain fart I suppose so I'm hoping someone can help me out. I've been working on this program that basically reads in a fasta file with multiple …

Member Avatar for NitaB
0
124
Member Avatar for el33t

Hi, Is this a valid while loop? : while((grid[tr][tc]=='0'||grid[tr][tc]==s[i]) && tr<row && count<strlen(s)) { ++count; ++tr; } Although the full program compiles fine, but *sometimes* my program crashes during runtime giving me a "Access violation(Segmentation Fault)" error and the debugger points to this loop statement... By the way, I'm using …

Member Avatar for Gribouillis
0
179
Member Avatar for Valiantangel

I was reading a book and it said "Mac names cannot be overloaded and the macro preprossor cannot handle recursive calls: #define PRINT (a,b)cout<<(a)<<(b) #define PRINT (a,b,c) cout<<(a)<<(b)<<(c) /*trouble?:redefines,does not overload*/ Can someone pls explain possibliy with examples?

Member Avatar for Valiantangel
0
117
Member Avatar for mayank.dyl

Given two integers A & B. Determine how many bits required to convert A to B. Write a function int BitSwapReqd(int A, int B); Please first define the logic to calculate the number of bits required to convert A to B and then code. Thankx a lot.

Member Avatar for gusano79
0
485
Member Avatar for dls_20022002

Hello All, I am new to C programming. I was trying to write a code that will allow me to take an array of n elements, and take every combination of pairs and write it. example: array: 1, 2, 3, 4, 5 output: (1,2), (1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5) I would truly appreciate the …

Member Avatar for zeroliken
0
336
Member Avatar for hwoarang69

how to remove zeros from int array? for ex if i have a array 1,2,0,34 than result is 1,2,34. i was thinking may be use trim function? another idea was to put space. for ex 1,0,2,0,3 than reslust is 1, ,2, ,3 note iam trying to do this without making …

Member Avatar for Vish0203
0
6K
Member Avatar for Dewey1040

I've attempted to create a linker for assembly files, what the program does is not the issue here though, I havent used pointer arithmetic in a few years and am definitely rusty in doing so. I'm getting a segmentation fault when I attempt to run the file and would like …

Member Avatar for Dewey1040
0
168
Member Avatar for Brasa619

Im suppose to have this prompt me via stderr to enter two 32-bit keys. I use fgets tofrom stdin to read up the line the user inputs. Then im suppose to parse the line into tokens using strtok_r that converts them to unsigned longs. I already have a function strToULong.c …

Member Avatar for DeanMSands3
0
179

The End.