15,550 Topics

Member Avatar for
Member Avatar for sarawilliam
Member Avatar for ArkM
0
96
Member Avatar for CPPRULZ

Hi lately i have been studying the malloc and calloc functions for dynamically allocating memory. I thought the form was: [code=C] (data_type*) malloc(data_size); [/code] But then I stumbled onto this code snippet on a tutorial site: [code=c] #include <cstdlib> void *malloc( size_t size ); [/code] Why is the data type …

Member Avatar for Narue
0
376
Member Avatar for akim_atl

Ok I know, scalar() function uses po1→x to access the first member of a structure. Can po1.x or (*po1).x be equally used within the function to access the same member?

Member Avatar for Salem
0
48
Member Avatar for donjohnson24

Hi, Back in the 70s or 80s I wrote a c program for running a Tote at a Race Night - an evening where films of horse races are shown for people to 'bet' on the winner. Not really betting - more like a raffle - but my program enabled …

Member Avatar for donjohnson24
0
139
Member Avatar for rajenpandit

Hello everyone, I have created my own header file but it doesn't work if i just include like "myfile.h" and it works fine if i include like "myfile.c". I just want to know that why this thing happening in Turbo C compiler even it works fine in VCpp.

Member Avatar for Freaky_Chris
0
91
Member Avatar for crsurfer

Hi, guys i need some help! i need to make a txt file with the "-A" command (in shell). that already is implemented in the client, then the client send the file thru sockets and arrive to the server, the server save the file in his directory. But the code …

Member Avatar for Belrog
0
145
Member Avatar for snehapatil

Hello to all, I am doing a serial communication program in which i want to send '80' (in hex ) to DSP and then DSP will reply '1B' . But i am not able to set proper communication. Anybody please help me in my software My Program is given below …

Member Avatar for Belrog
0
190
Member Avatar for digi123

I would like to ask that PrintHello accepts a void pointer but how come you can equate it to an integer directly ??? " tid = (int)threadid; " while at the same time instead if a pointer a normal variable was passed into this function " pthread_create(&threads[t], NULL, PrintHello, [B](void …

Member Avatar for Belrog
0
299
Member Avatar for moonw3ll

I'm new in programming, i really really want to learn and i think i can learn faster if someone will give me problems so that i can answer them without asking for help from others. Now, i learned loop last week so i think i'm on for making programs. I …

Member Avatar for moonw3ll
0
255
Member Avatar for Rein Valdez

Hello Daniweb Forum People, I have this problem of getting the decimal of a number? How can I get it and copy to a variable? ex.... 1234.59 I used a for loop in order to get the index value of 59, my problem was with the value? how can I …

Member Avatar for Aia
0
159
Member Avatar for RexxX

This is a little program I'm writing to refresh my knowledge of C and I know it's wrong, but everything I've tried in order to fix it isn't working. [code] #include <stdio.h> #include <string.h> int main() { int const STR_LENGTH = 255; char str[STR_LENGTH]; int n=0,i=0; printf("Please enter a word: …

Member Avatar for death_oclock
0
111
Member Avatar for swetharvss

hi everyone....i have to convert decimal numbers starting from 1 to 1024 into binary and i need access to all the bits. i have done an example which generates a random number and converts it into a 10-bit binary number. this one worked fine for me... [code=c] for(i=0;i<10;i++) { sec[i]= …

Member Avatar for swetharvss
0
275
Member Avatar for les2

1.CREATE A FUNCTION [U]void mycpy[/U] to copy a string. 2.CREATE A FUNCTION [U]void mycat [/U] to cut and append a string unto another string. 3.CREATE A FUNCTION [U]void mycomp [/U] to compare whether two strings are the same or not. The prototypes of the functions are 1. Void mycpy(char*,char*) 2. …

Member Avatar for Ancient Dragon
0
79
Member Avatar for Lolly2009

My coding looks like this int main(int argc, char *argv[])/*command line input*/ { int len; char *t[10]; len=strlen(argv[argc-1]); temp[0]=argv[argc-1] if(strstr(t[0],"c"==NULL)/*to check for a c file input*/ printf("Not a c file"); else printf("C file"); } if my command line input in linux is ./a.out test.c argv[0] contains ./a.out ans argv[1] contains …

Member Avatar for ArkM
0
217
Member Avatar for Trendkiller

I am getting some errors. 4 are C2143 2 of which point to the function prototype void ArrayFunc(int, int, float, int[SIZE][2],float[SIZE],int &,int &); and the other 2 C2143 errors point to void ArrayFunc (int count, int hours, float total, int array1[][2], float array2[], int &row, int &column) (the function definition). …

Member Avatar for csurfer
0
105
Member Avatar for marksmania

Hi there, Think this is a pretty simple problem! I'm trying to create a header file with some physical constants. The Planck constant is giving me trouble due its tiny size in SI units. Essentially, defining a pre-processor constant using E-notation does not seem to work. My header file looks …

Member Avatar for csurfer
0
93
Member Avatar for vinwin

if (blink_status ==1){ //If led is bliking, stop it P1OUT &= ~ 0x01; // Turn Led off blink_status=0; }else blink_status=1; } Could anybody explain the logic please...

Member Avatar for vinwin
0
76
Member Avatar for bundersi

In the program, it can calculate the summation and subtraction of two integers. The integer can have 100 digits and can also be negative. How can i do this ?

Member Avatar for Salem
0
153
Member Avatar for me_ansh

Hi, I am facing a problem, I am accessing a text file through my C program to fetch some values. The problem is that, i want to check whether the text file is updated before opening it, as i want to save the time of opening the file again if …

Member Avatar for Salem
0
145
Member Avatar for dhiliptce

[code=cplusplus] #include<stdio.h> #include<stdlib.h> #include<iostream.h> main() { FILE *fp,*fp1; int numbers[30]; char *buffer; int i=0,j; // To read the file fp=fopen("PR1.txt","r"); if(fp==NULL){ printf("Error: can't access file.c.\n"); exit(1); } else { printf("File opened successfully.\n"); for(i=0;i<10;i++) { // while(!feof(fp)) { /* loop through and store the numbers into the array */ printf("Number- %d", …

Member Avatar for rajenpandit
0
118
Member Avatar for ahamed101

Hi All, I am trying to write a common function called call which will take in a void* and an int type. Based on the int type it will have access to different structures. The code doesn't compile in the first place. I am not sure this is correct or …

Member Avatar for ahamed101
0
106
Member Avatar for slimjimmer

I am trying to produce a program which produces a random array of numbers but I am running into a problem in that when the array becomes even a little large, say 10x10, I get the Bus Error or Segmentation Fault (I think I still get the error with even …

Member Avatar for Salem
0
225
Member Avatar for drjay1627

I'm doing a OS class. Trying to implement this pseudo code: * Forking is fun! ­ Simple tips First, fork the child process: pid_t ForkPID; ForkPID = fork(); Then write a quick switch statement! switch (ForkPID) { // ­-1, fork failure case ­-1: printf("Error: Failed to fork.\n"); break; // 0, …

Member Avatar for drjay1627
0
140
Member Avatar for lonely_girl

I need a statement to exit my program after goto statement but i dont know where to place this statement. The statement is: [CODE=c]printf ("Enter \".\" to exit or \"p\" to proceed"); scanf("%c",&ch); if (ch=='.') getch(); if (ch=='p') goto repeat;[/CODE] also tell me if its rite or not? [CODE=c]#include<stdio.h> #include<conio.h> …

Member Avatar for lonely_girl
0
133
Member Avatar for Anshulpareek
Member Avatar for Duoas
0
40
Member Avatar for Somersett

If I allocate memory to a pointer which has been declared inside of a function as static, and don't free() it, is that memory freed when the function returns?

Member Avatar for Duoas
0
109
Member Avatar for swetharvss

Hi....I need to convert a 1D array into a 2D array of numbers....can anyone help me out with this? the problem goes like this... I have a string of numbers say.. 0.123762 0.346515 . . . . . to a total of 275. i need to group them in the …

Member Avatar for swetharvss
0
115
Member Avatar for Demonisya

Hello Once Again..... I need you to help me with this program im working. My teacher asked me to create a program that could arrange the random numbers from lowest to highest.... but I can't follow up what's next in my program: [CODE=SYNTAX] #include<stdio.h> #include<conio.h> int main() { int a,b[10]; …

Member Avatar for its.romi
0
386
Member Avatar for lonely_girl
Member Avatar for csurfer
0
1K
Member Avatar for deepugtm

I use Turbo C++ compiler.I want to include a photo through C program using file handling or something else.Do somebody have any idea for this.

Member Avatar for deepugtm
0
91

The End.