15,550 Topics

Member Avatar for
Member Avatar for vedro-compota

Mates, this is my first piece of C code. I do not know what is wrong. Please, tell me, that's not so I've highlighted the lines that the compiler "doesn't like " - [CODE]#include <stdio.h> #include <alloc.h> #include <stdlib.h> main() { short int n = 0; int k=0,u,i=0; char a=''; …

Member Avatar for vedro-compota
0
100
Member Avatar for Joey_Brown

Hello. Im interested in learning something about allocating memory for a 2d array. So I have a function that does this, and it goes something like this : [CODE]short **g2D(short **arr,short row,short col) { short i; arr=malloc(row*sizeof*arr); if(!arr) { printf("\nMemory unavailable"); exit(EXIT_FAILURE); } for(i=MIN;i<row;i++) { arr[i]=malloc(col*sizeof*arr); if(!arr) { printf("\nMemory unavailable"); …

Member Avatar for Trentacle
0
150
Member Avatar for shadowscape

hey im new to daniweb, i recently wanted to revise a code for a dll but being as i dont really know c++ i turned to the help of daniweb if you would be so kind to assit me correct any problems with this code it would mean alot to …

Member Avatar for shadowscape
0
520
Member Avatar for johnloiebert

[code] #include<stdio.h> #include<conio.h> void main(void) { int a1,a2,a3,a4,a5; clrscr(); scanf("%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5); printf("%d%d%d%d%d",a5,a4,a3,a2,a1); getch(); } [/code]

Member Avatar for vinitmittal2008
0
128
Member Avatar for vinitmittal2008

The Program is Addition of Large Integers.. Although This program is working But I want to know where i went wrong or what should i need to do to make it better.. [CODE] # include <stdio.h> # include <stdlib.h> # include <ctype.h> # include <string.h> typedef struct poly { int …

Member Avatar for vinitmittal2008
0
188
Member Avatar for kiel19

Write a c program that inputs the names of the 5 students and their marks in 5 course units. the program must calculate the average for each student. If the average of the students's marks is less than 50, then your program should print against the student the string"Sorry try …

Member Avatar for WaltP
0
3K
Member Avatar for AlexYIN

Hey! We all learn file processing [ATTACH]18526[/ATTACH] I don't understand what is the difference between "for writing" and "for update". Could you please explain that? Thx so much!

Member Avatar for AlexYIN
0
140
Member Avatar for lmytilin

[CODE]#include <stdio.h> #include <string.h> #include <stdlib.h> int getNumWords(char *name) { int i,numofwords=0; for(i=0;i<strlen(name);i++) { while (name[i]==' ') { i++; //pernaei ta kena osa k an einai. akoma k an einai stin arxi k sto telos } if (((i==0)&&(name[i]!=' '))||(i>=1)&&((name[i-1]==' ')&&(name[i]!=' ')&&(name[i]!='\0'))) { //i 1i sun8iki einai gt an to i …

Member Avatar for myk45
0
2K
Member Avatar for omkar1987

i trying to to open a text-file in read mode and passing that file pointer to a function which will extract the text from that file pointer .... but every time i build and run the program i get the segmentation fault error at the start of the "loadtoFile" definition …

Member Avatar for WaltP
0
122
Member Avatar for spring10

Hi, Trying to write some C code for an assignment using a PIC16F84 for a digital watch/alarm. RA0 to increment time RA1 to decrement time RA2 set-move to next digit RB7 set time/alarm RB6 enable/disable alarm 1. press RB7 once to set time. 2. press RA0 or RA1 repeatedly until …

Member Avatar for MudasirAli
0
361
Member Avatar for moroccanplaya

i have creaed a loop that lets the user creates a file then copy a file to it and also allows the user to add more than 1 file to be copied. the problem that i found out is that when the progam goes back round the loop it drops …

Member Avatar for Dervish1
0
79
Member Avatar for rate
Member Avatar for natha_peepli

i wann multiply two matrix but the part of given code is not working...i wanna input the value from the user using pointers.. [CODE]#include<stdio.h> #include<conio.h> void main() { printf("This is matrix multiplication program"); printf("\nEnter the dimensions of two array "); int Row1 = 0, Col1 = 0, Row2 = 0, …

Member Avatar for myk45
0
243
Member Avatar for halil.burak

I dont know what to do ADDING ELEMENT.first selection in the main menu....pls help me... A cluster is defined as a collection of different elements. A and B, including two sets of integer elements that are required for a program to perform certain procedures on the sets. To do this, …

Member Avatar for halil.burak
0
214
Member Avatar for comwizz

I would like to know the exact difference between calloc and which is more useful?? Though calloc allocates memory in the form of blocks and malloc in a single block , do they both allocate memory continuously and if there is an obstacle , would calloc be able to jump …

Member Avatar for roshan.nits
0
299
Member Avatar for motigeva

i got this exercise and i wrote this code. [IMG]http://img42.imageshack.us/img42/8331/37255827.png[/IMG] i have a problem with the bubblesort part becouse it thinkes it's void pointer. i don't think i nedd to write the program 8 times there must be a way tnx a million [CODE]# include <fcntl.h> # include <stdio.h> # …

Member Avatar for rafi1082
0
120
Member Avatar for hsetaknev

i have a problem with my coding to fing wether given string is palindrome or not without using strcmp(); and srtrev(); it returns "the string is not a palindrome " for all string the [CODE]#include<stdio.h> #include<string.h> void main() { int n,i,j; char a[100]; scanf("%s",a); n=strlen(a); printf("the length ia%s,%d\n",a,n); while(i<=j) { …

Member Avatar for Shankye
0
112
Member Avatar for kapilsolanki84

how to produce output without console window in c code? using dev c++ as compiler.say i have a prog. and it produces the output in console window as well as in text file. now i wan the output only in dat file not in console window. on executing the exe …

Member Avatar for VernonDozier
0
206
Member Avatar for cmaheshwari16

Hi All, I want a C programme which will take a user input as a date and number of days, and then it will add the given number of days to the input date and will give the resulted date. It should keep in mind all the permutation and combinations …

Member Avatar for sharathg.satya
0
8K
Member Avatar for vinitmittal2008

Let P1 and P2 are two polynominals.. where p1 = 1 + 4X^2 + x^4 and p2 = 2x^2 + x^4 program is to multiply p1 with p2 p3 = p1 * p2 Like line 1: ( 1 + 4x^2 + x^4) (2x^2 + x^4) line 2: 1*(2x^2 + x^4) …

Member Avatar for Shankye
0
148
Member Avatar for Sniper rooney

please can anyone make a program in c language to convert a number from decimal to hexadecimal system using switch statements and please don't use arrays or %x

Member Avatar for WaltP
0
89
Member Avatar for Snehamathur

I want to know the procedure by which we can calculate time complexity of a C program. and how would we compare two algorithms. here are two sorting programs. how to compare both. [CODE] for(i = 0; i < n - 1; i++) for(j = i + 1; j < …

Member Avatar for vinitmittal2008
0
290
Member Avatar for becka221

My code is giving a wrong output for the 3rd pair of vectors im finding the dot product of, although the first two are correct. (outputs - 0, 3, -3(should be 1))... I just cant find wahts wrong, i was guessing something to do with the -1 in the b …

Member Avatar for becka221
0
98
Member Avatar for endsamsara

Hi, well i take lots of time figuring this out. I need a program that tells me the coordinates of a word that is in other array, what I have gotten is the y coordinate "the column", but I need to do the case for a bidimentional array get the …

Member Avatar for endsamsara
0
158
Member Avatar for garevn

Hello, i am new in c programming it is just the second month i i deal with. I am really confusing about what i have to do with this exercise pls don't lough on me :( I hope for some help. That's what i have to do.. I have to …

Member Avatar for Trentacle
0
337
Member Avatar for techie929

Hi , I am trying to reverse a string using pointers.I am able to reverse a sting like this: My Reverse Program --> margorp esrever em But I want it word by word. Program Reverse My. [CODE] #include <stdio.h> #include <string.h> char str[50]="Reversing a string using XOR"; char strb[50]; char* …

Member Avatar for gerard4143
0
132
Member Avatar for ChEeZeBaLL

I'm new to C programming and I am trying to write a simple ID3 tag editor for mp3s. An id3v1 tag is the last 128 bytes of the file, with 30 characters for the artist, 30, for the title, etc... So far I have written this program which saves each …

Member Avatar for Dervish1
0
1K
Member Avatar for danyesu86

Hey guys, I have a question regarding this code I made some days ago.. (works fine) [CODE]#include <stdio.h> /*para printf(),scanf()*/ #include <conio.h> /*para getch(),clrscr()*/ #include <stdlib.h>/*para exit()*/ #include <math.h> //#include <dos.h> //#define NUMEL 20 double f(double x); void _error(int n); enum{INTERVALOS}; enum{SIMPSON1_3=1,SALIR}; int n; float a,b; //float X[NUMEL],Fx[NUMEL]; /*Metodo de …

Member Avatar for myk45
0
99
Member Avatar for Colin Mac

Hi, I'm a beginner and just started Turbo C I wrote this program in the editor main() { float years, days; printf ("Please type your age in years:"); scanf ( "%f", &years); days = years * 365; printf ("You are%.1f days old.\n", days); } I then run the program and …

Member Avatar for Shankye
1
278
Member Avatar for yuri1969

Hi, I have prolly very noobish question. I compile my program separately with GCC by: [CODE]gcc -O2 -Wall -c foo.c[/CODE] I just wat to ask if there is a chance to specify the output destination of [B]foo.o[/B] file. Now the output is forwarded to the makefile dir. Thank you for …

Member Avatar for yuri1969
0
2K

The End.