15,552 Topics

Member Avatar for
Member Avatar for cppgangster

Hi there, I am having a problem of passing arrays to functions, here is my code: void zeroMatrix(float **arr); void main() { float e[2][2]; zeroMatrix(e); } void zeroMatrix(float** arr) { int i,j; for (i=0;i<2;i++) { for(j=0;j<2;j++) { *( *(arr +i)+j) =0; } } } The problem is I want to …

Member Avatar for David W
0
339
Member Avatar for shaneetra.graham

would like some ideas of how to acutally create my own cd function from scratch using C programming.I'm building a shell program in C.

Member Avatar for Ancient Dragon
0
491
Member Avatar for blue_Student

Hi, i have this project where the size, 2d array of size n is scanned from a file; asks for the vertex pairs from the command prompt until the user decides to stop inputting them. There is something wrong with my code because it skips the scanning of int variables …

Member Avatar for Ancient Dragon
0
509
Member Avatar for Adox

Hello, I was wondering if someone could help me in this case. I need the program to open a txt file. But the User shall inform the location where the file resides. Can be by text. Example: "C: \ documents \ test.txt". To open files I know just the fopen.

Member Avatar for rubberman
0
224
Member Avatar for rakesh.menon.16

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 …

Member Avatar for rubberman
0
469
Member Avatar for shaneetra.graham

I was having a little trouble with parsing my command upon input, I'm new to C so any help would be greatful! Here is what i have so far i'm trying to make a simple unix shell char*token; while(1){ //prints users prompt printf("\n%s@myshell:%s>", username,curDirect); //gets string from command line fgets(buffer, …

Member Avatar for Ancient Dragon
0
166
Member Avatar for getmeusername

Hi All, I am new to c programming. I have mulptiple c files which uses the client.h Currently I am using my header file in each and every place where my c code is placed. Can I put it at one particular location and use it as #include<client.h> in my …

Member Avatar for Ancient Dragon
0
198
Member Avatar for nakul_pancholi

Dear all, I am learning C language. I got the following problem while running the problem. Program: [CODE]#include <stdio.h> #include <math.h> #include <stdlib.h> main() { int x; for (x = 1; x <= 250; x ++) printf("x = %d\n", x); }[/CODE] OUTOUT should be: x = 1 x = 2 …

Member Avatar for arulgee6
0
1K
Member Avatar for tux4life

One of the things which attracted my attention was that there are often newbies asking how to create a password program in C/C++, often they don't succeed, well here's my response, you can use it for any purpose you want, one thing you'll have to keep in mind is that …

Member Avatar for Remy1990
0
8K
Member Avatar for David W

In the last few days, I have noticed a very old thread ... resurrected ... about a non-standard C getline function. To all who may like a C readLine function ... a C function that reads in a dynamic C string of any length ... a function with a similar …

0
211
Member Avatar for john.kane.100483

OK so I'm almost done with my program. How to put this in function like putting each case like void Binary2Decimal() , void Octal2Decimal() & , void Hexa2Decimal() in "TURBO C++"? Call a function like I only want to display only the Binary to Decimal case. #include<iostream.h> #include<conio.h> #include<stdio.h> char …

Member Avatar for pritaeas
0
132
Member Avatar for kamil_2

I installed the New version of dev c++ 5.6 for implement graphics programmes in c and i done all the steps like put graphic.h files,and add linkers in parameters. i done every step correctly but when i go to compile the simple graphics programme it will show the error line …

Member Avatar for Ancient Dragon
0
183
Member Avatar for taverasme

Hi all, First time poster here, I've referenced posts here on daniweb in the past and it has always been helpful, thanks! But I can't find the answer to this particular problem here on the forums. I need to write a basic string parser as part of a coding assignment …

Member Avatar for Nikolas9896
0
6K
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> int main() { int i=1,fact=1,n; printf("enter the no of fact: "); scanf("%d",&n); factorial(n,fact,i); return 0; } int factorial(int x,int y,int z) { int r; if(x==1) { r=y*z; printf("the fact is %d",r); } else { factorial(x--,y*z,z++); } } hello iam trying recursion using factorial the complier stops …

Member Avatar for Reverend Jim
0
146
Member Avatar for chipo

I am trying to parse a date stored as an array of characters. I have a problem to paerse the date with a loop otherwise it works fine. char date[]="20141018"; //the date is 10/18/2014 char _mypointer=date; char year= "YYYY"; char month="MM"; char day= "DD"; year[0]=*my_pointer + 0; month[1]=*my_pointer +1; What …

Member Avatar for David W
0
157
Member Avatar for Snehamathur

[CODE] /* Any year is input through the keyboard. write a program to determine whether the year is a leap year or not. */ #include <stdio.h> #include <conio.h> void main(void) { int year; clrscr(); printf("\n\n enter a year::"); scanf("%d",&year); if(year%400==0) printf("\n\n Leap Year."); else if(year%100==0) printf("\n\n Not Leap Year."); else …

Member Avatar for stephen.beatson
0
380
Member Avatar for pavani2006
Member Avatar for swaar.metaal.7

Hi everyone, I am new here and I hope all of you are doing well. I have spent the whole day searching around on the almighty Google for code that can help me with my problem. In the following code there may be quite a few n00b mistakes, and for …

Member Avatar for swaar.metaal.7
0
269
Member Avatar for yann.bohbot.9

hey everyone! having a small problem with my pointer. I'm just trying to scan an array using a pointer but when i print it it shows me only zeros. Any help? #include <stdio.h> int main() { int arr[10]; int *ptr; int i; ptr = &arr[0]; printf("Enter 10 integers:\n"); for (i=0; …

Member Avatar for sepp2k
0
128
Member Avatar for it mansoor

write a program in c who get input from key board and then show the addition of numbers

Member Avatar for Deep Modi
-2
170
Member Avatar for glao

(Continued from [here](http://www.daniweb.com/software-development/cpp/threads/474128/column-major-not-shown-right#post2070227) ) I am trying to use column major order to a 2d matrix which I am using as 1d. int N=3,R=2; for (int i=0;i<N;i++){ for (int j=0;j<R;j++){ //printf("\nX[%d]=%d\t",i+j*N,res[i+j*N]); //column major // printf("\nX[%d]=%d\t",i*R+j,res[i*R+j]); //row major } printf("\n"); } but the column major doesn not work as it should. …

Member Avatar for David W
0
438
Member Avatar for COKEDUDE

Can you please explain what this weird int declaration does. Here is the block of code. void show(void *u, int w, int h) { int (*univ)[w] = u; printf("\033[H"); for_y { for_x printf(univ[y][x] ? "\033[07m \033[m" : " "); printf("\033[E"); } fflush(stdout); } This is the line I'm talking about. …

Member Avatar for Ancient Dragon
0
255
Member Avatar for Jason_9

I'm totally new to programming and taking an intro class. When i prompt the user for a state code the program just exits, nothing in my book really goes over this and all im given is crappy youtube videos for reference. Any help is greatly appreciated. #include <stdio.h> #include <stdlib.h> …

Member Avatar for David W
0
261
Member Avatar for COKEDUDE

Can someone please explain what unistd.h does and the purpose of it? I have been googleing the last hour and I don't understand it.

Member Avatar for COKEDUDE
0
129
Member Avatar for churchill.omorere

Design a C program that will convert temperature values from degrees Celsius to degrees Fahrenheit. The user must enter a start and a finish value, together with a step value. The program must convert all temperatures beginning with the start value at the given step interval. Use the …for()… statement …

Member Avatar for BobS0327
-1
170
Member Avatar for jalferez1

i asked this on the C++ forum but someone told me to try it here on C. here's my first program there are some error with this program, i can't debug it. what's the problem? #include <stdio.h> #include <conio.h> #include <ctype.h> #include <string.h> int main(void) { int strlen, a, b,c; …

Member Avatar for jalferez1
0
217
Member Avatar for kalyan_1

Could some one help me out with the basics of Structures ? How to use them in C programs ? etc.. Thanx in advance.

Member Avatar for David W
0
130
Member Avatar for nitin1

hi, Can anyone suggest me the approach for finding the lcm of the n numbers? my approach: find the max of the n numbers and start dividing it by all numbers , if all are dividing it then print it, else take next multiple of the max number and repaet …

Member Avatar for ShapesInClouds
0
3K
Member Avatar for Tinnin

Hi all, I've bought the book "Objective-C Programming - The Big Nerd Ranch Guide" and I'm running through the beginning chapters which just regard C. I'm doing this on my laptop running linux as I don't have a Mac (yet). I'm having trouble with this code: #import <stdio.h> #include <readline/readline.h> …

Member Avatar for Tinnin
0
2K
Member Avatar for coding101

I need to create a scenario where all 65535 ports are open. I currently can open 1021 socket desciptors and bind to 1021 ports. If i spawn ~ 70 processes todo the same, i can achieve the goal, but performance is slow. I'm not interested in packet sniffing. How can …

0
72

The End.