15,550 Topics

Member Avatar for
Member Avatar for khaled_jawaher

hi, If I have a union like union Type { struct Student s; struct Employee e; }type; and a struct person like struct Person { char firstname[10]; char familyname[20]; char telephone[10]; union Type type; }p; how can i check whether type of union in person is student or employee?can i …

Member Avatar for sepp2k
0
146
Member Avatar for Nak Machine

can you help me with my program, actually its already ok but my prof.said that me need to put a rendered money and give the the total change,but when you enter a character just like (a,b,c,d,e,f,g etc..) the change will be higher amount i want it to know how to …

Member Avatar for rubberman
0
110
Member Avatar for edensigauke

I am a little new to C, and i would like to learn how to generate graphics using C. I have been informed that i should use SDL libraries and SDL is dependant on Code::Blocks. but installing them is like walking in a maze

Member Avatar for rubberman
0
153
Member Avatar for Toby14

I have a question like this. Write a program that reads integer from keyboard. If I enter a negative number it return a negative number. If all the numbers I enter are positive numbers then return the average of these positive numbers. Can someone help me out this problem? Thank …

Member Avatar for safaklx
0
97
Member Avatar for MIOCUNARD
Member Avatar for iamthwee
0
47
Member Avatar for ms95

hi i want To Write a PhonBook program in c which will accept a Name and a Number from the User an save them in a struct, the problem is how to create a new structure name every time : here is the could , though its not work but …

Member Avatar for ms95
0
945
Member Avatar for LostnC

Hello. I am a beginner. I have searched the past threads, but I haven't found any help. My assignment says to write a function to swap 2 values using pointers. Write a main function that inputs 2 numbers. Have it call the swap function if the numbers are NOT in …

Member Avatar for deceptikon
0
3K
Member Avatar for somjit{}

My Program is about Directed Graphs. It reads a list of edges like : `25 589` , and puts 589 into the adjacency list (a linked list) of 25. My input file has about 5 Million such `v w` edges, with about 800K nodes/vertices, for each of which there will …

Member Avatar for somjit{}
0
469
Member Avatar for negru

Hi. I have a question about one function in my program. Write a function that will replace players in a tim. New player gets in the game, and takes the place of one that leaves. Prototype of function is: void replace(TEAM *p,PLAYER newplayer,int num) where second parameter is new player, …

Member Avatar for iamthwee
0
133
Member Avatar for safaklx

I have a question about game programming with c. I should add a background music on my game, and the same time i want to move my character on it. i used that way for solution PlaySound("sample.wav",NULL,SDN_SYNC); playing music ok but i cant move my character...

Member Avatar for safaklx
0
116
Member Avatar for negru

Hi. How to find index of first letter in every word in a string? For example, input string is: Programming Languages. Output should be: 0 12, those are the indexes of letters "P" and "L". I tried different approach, to print those numbers but that didn work. Thanks for the …

Member Avatar for TalhaMoazSarwar
0
182
Member Avatar for glao

Hello , I found this puzzle : typedef struct { int dd[ 5 ]; int tx; } node; node * A = new node[ 10000 ]; for ( int i = 0; i < 100000; i++ ) { for ( int j = 0; j < A[ i ].tx; j++ …

Member Avatar for glao
0
149
Member Avatar for negru

Hi. I need help finding the longest word in a string. How to return last longest word if there are two or more words with the same (longest) length? My code: #include <stdio.h> #include <string.h> int main() { char string[100], word[20], max[20], min[20], c; int i = 0, j = …

Member Avatar for deceptikon
0
10K
Member Avatar for anumash

I have just started developing and writing linux kernel modules and device drivers. I am having a lot of trouble understanding new data types that I haven't encountered while writing application programs. For instance, I am having difficulty understanding what is the purpose of size_t, ssize_t, loff_t etc? Why use …

Member Avatar for mike_2000_17
0
248
Member Avatar for aundriaah

Hello!!! I am trying to get my program to run in Visual Studio 2012, but it won't. I keep receiving errors on my brackets, such as missing function header or 'expected a declaration'. I knew they were messed up from the start, but I just can't seem to get it …

Member Avatar for rubberman
0
299
Member Avatar for brandon66

Alright can you guys tell me why the first call to printOcean prints out the memory address of the arrays rows/cols and the second one prints like its suppossed to with 0's which the array is filled with #include <stdio.h> #include <string.h> //macro #define FLUSH_STDIN(x) {if(x[strlen(x)-1]!='\n'){do fgets(Junk,16,stdin);while(Junk[strlen(Junk)-1]!='\n');}else x[strlen(x)-1]='\0';} //define constants …

Member Avatar for brandon66
0
195
Member Avatar for sdtechi

#include<stdio.h> int factorial (int); void main() { int a,fact; printf("\nEnter a value:"); scanf("%d", &a); fact= factorial(a); printf("Factorial value=%d", fact); } int factorial (int x) { int f=1,i; for(i=x;i>=1;i--) f=f*i; return(f); } Enter any number: 3 Factorial value = 6 But i did not undartand this program. Mostly in the loop …

Member Avatar for Santanu.Das
0
146
Member Avatar for lewashby

I have a few questions about libraries and header files. Since libraries are binary files and header file are source/text files why do they not just compile the header files along with the rest of the library files? It doesn't make sense to me to have libraries that are binary …

Member Avatar for gusano79
0
182
Member Avatar for Marz_1

Goodmorning guys, I'm trying to compile a simple SDL project with gcc in mac OSX Maverick... This is my main.c file: #include <stdio.h> #include <stdlib.h> #include <SDL/SDL.h> int main( int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); printf("Grande!\n"); SDL_Quit(); return 1; } In facts my function do nothing but I just want …

Member Avatar for Moschops
0
221
Member Avatar for sdtechi

#include<stdio.h> #include<conio.h> void main() { textbackground(BLUE); textcolor(WHITE); clrscr(); gotoxy(30,9); printf("Welcome to"); gotoxy(30,10); printf("Program2Do"); getch(); } It is a simple color chnaging C program. I had run it on Codeblock. But got error in this line: textbackground(BLUE);

Member Avatar for iamthwee
0
199
Member Avatar for cutedipti

Hello all, I am implementing linked list programs in C. And for that i want to know more about Self Referential Structure in C. If anyone knows more detail information about it then please tell me. I am having one example here which helps you to understand more clearly what …

Member Avatar for mungara
0
1K
Member Avatar for uws101

Why the following printf of the buffer in the readWav() causes segmentation fault just after printing the first row to the screen? Are there any issues with the use of pointer in printf("%d\t %f\n", i, *buffer[i]);? #include <stdio.h> #include "sndfile.h" int readWav(const char *const fname, long *numFrames, int *sRate, float …

Member Avatar for rubberman
0
138
Member Avatar for choconom

Hi, I need to use getopt for a program called like myprogram.c file1 file2 file3 -t. Now I've read some examples about how to use switch cases for options with hypens (-t). But I don't get how to write this for my file1, file2, and file3 (they are arguments that …

Member Avatar for rubberman
0
174
Member Avatar for Ashish_16

What is the output for the code - void main() [ int i=4,x; x=++i_+_++i_+_++i; printf("%d",x); ]

Member Avatar for rubberman
0
102
Member Avatar for chrjs

I am doing this assignment for my computer science course, and I have to write a function that determines if 'x' can fit into an n-bit, two's complement integer. I am not allowed to use any control statements or operators other than the [ICODE]! ~ & ^ | + << …

Member Avatar for mbelenske
0
2K
Member Avatar for Faissalelbarhami

Hii All, i am a begginer at c programming in the first semetser of study, and i am trying to doing my project what is: Diff — The program should compare two text files and list the differences, i.e. lines and columns of the beginning and the end of a …

Member Avatar for Faissalelbarhami
0
371
Member Avatar for Nataliya_1

Filter and process data Download the file population.txt from webcourse. The file is a formatted text file with 3 columns: country, city and population. Read the file and create a short c program to do the following: a.display the name and the population of the city with the highest population …

Member Avatar for Moschops
0
212
Member Avatar for Marz_1

Goodevening, I'm starting coding in C and I've done a little program to understand "struct" function, but... I receive this message: Segmentation fault: 11 I've understood a bit what this problem is about, but I can't understand where it borns on my program. Can you help me? I tank you! …

Member Avatar for Marz_1
0
201
Member Avatar for glao

Hello , I want to scan each row and find in each column the max element and the corresponding index. Then , swap this column with the column which belongs to the main diagonal ( if a condition is valid ). Finally , do the same for the rest rows. …

Member Avatar for glao
0
208
Member Avatar for uws101

int subroutine (char *input, float *buffer) { *buffer = malloc(...) buffer is calculated from input } or flot subroutine (char *input) { *output = malloc(...) buffer is calculated from input return(buffer); } int main(int argc, char *argv[]) { float *data; subroutine(argv[] ...) ... free(data) } 1) which subroutine is recommended? …

Member Avatar for uws101
0
131

The End.