15,550 Topics

Member Avatar for
Member Avatar for Esmerelda

I just want to know the exact difference between intialising and assigning a variable. Is it possible to initialise a variable multiple times in C prog or is it just initialise once n assign all the other time...can somebody help me out please.

Member Avatar for WaltP
0
97
Member Avatar for FC Jamison

I am trying to learn how to write a merge sort function, but I have only gotten so far with the book I am using now: [code] template <class T> void mergeSort(vector<T>& s) { mergeHelper(s.begin(), 0, s.size()); } template <class Itr> void mergeHelper(Itr start, unsigned int low, unsigned int high) …

Member Avatar for Lylla
0
177
Member Avatar for idiotguy

Hi friend! I wanna create my own online sms site. But I stuck with something. That is, i got an open source gateway called [kannel](http://www.kannel.org) But what I want to know is,what are the key ingredients for an online sms service. I mean the stuff i want to create online …

0
141
Member Avatar for getanshub4u

I am trying to parallelize the [Guibas Stolfi delaunay triangulation](http://goanna.cs.rmit.edu.au/~gl/research/comp_geom/delaunay/delaunay.html) using openmp. There are two things to parallelize here- the mergesort(),which i did and the divide() where I am stuck. I have tried all possible approaches but in vain. The approach followed(divide n conquer) in divide() is same as that …

0
113
Member Avatar for jumbowat

Hi every one, #include <stdio.h> #include <conio.h> #define SIZE 4 int main(){ char Menu[SIZE] = {'A','B','C','D'}; int i; for(i=0; i<(SIZE); i++){ // print the array elements printf("\t%c",Menu[i]); } getch(); } I want to swap the elements of the array for e.g. if I pass A and D or Menu[0], Menu[3], …

Member Avatar for jumbowat
0
6K
Member Avatar for freddyk

I was just experiminting with the following C code and i noticed something interesting.. The first loop runs fine, but from the second loop the variable r1 occupies the kernel address space(ffffffffe) and instead of randomly changing as it is supposed to, all the consecutive loops show r1 as occupying …

Member Avatar for rubberman
0
159
Member Avatar for BlackJavaBean

I'm trying my hand at OpenCV and have run into a problem that Dr. Google hasn't been able to help me out with. According to O'Reilly, the following code should play an AVI file in a window the program creates. [CODE] #include "highgui.h" #include <stdio.h> int main( int argc, char** …

Member Avatar for nhadley
0
652
Member Avatar for hwoarang69

*i am trying to copy the value of ar2[10] //in main. has the value 1,2,3,4,5 in ar[10] //(in struct node). empty array so to copy the value iam not sure if i could use a strcpy for ex, strcpy(head->ar, ar2); //here is my code struct node { int ar[10]; //empty …

Member Avatar for hwoarang69
0
146
Member Avatar for thorpntell

Okay, I know there is a prior article about this, but I used { } with my if statements, and it's still not working... is it because I have multiple if statements consecutively after another? #include <stdio.h> #include <stdlib.h> #include <time.h> int i, n,t, s[51],p=1,a,b,c; int main() { srand(1); for(i=0;i<=51;i++) …

Member Avatar for scudzilla
0
4K
Member Avatar for niyasc

Is there any standard function in gcc that is equivalent to getch() so that I can read the input without hitting enter key?

Member Avatar for jaybhanderi
0
7K
Member Avatar for Vish0203

I wrote this program... Just gave a try!! i got a problem with searching a string in file.. the **"checkp"** used in the login function, returns a value **"1"**, whereas it must return a value **"0"** Hence my program fails... what i felt is, the file i'm opening, **"web_reg.txt"**, in …

Member Avatar for Vish0203
0
186
Member Avatar for willjohanz

a class of 20 students. The information of each student contains ID, Name, Sex,exam Scores (3 quizzes per semester), mid-term score, final score, and total score #include<stdio.h> #include<conio.h> void main() { struct student { int id; char name[20]; char sex; int mid; int final; int total=mid+final }; int i struct …

Member Avatar for Vish0203
0
2K
Member Avatar for willjohanz

#include<stdio.h> #include<conio.h> void main() { struct student { int id; char name[20]; char sex; int mid; int final; int total=mid+final }; int i struct student b [19]; for(i=0;i<20;i++); { printf("student %d enter your details\n\n",i+1); printf("enter your id"); scanf("%d",&b.id); printf("enter your name\n"); fflush(stdin); scanf("%s",&b.name); printf("enter your sex\n"); fflush(stdin); scanf("%c",&b.sex"); printf("enter mid …

Member Avatar for Vish0203
0
2K
Member Avatar for hwoarang69

iam trying to store all the data in to a struct so i can change it later. //this data is in file abc 1 11 22 def 2 33 ghi 0 22 11 33 asd 2 i was planing on making a array of structs. so 1st line will have …

Member Avatar for hwoarang69
0
223
Member Avatar for hwoarang69

trying to copy pointer in array. lets say *pointer has the value "COMPUTER". and i want to store in array[o]; note: i want to use strcat to do this and i do not want to do some thing like "array[0]" char test[10]; char *point; //has the value "COMPUTER" for(int i …

Member Avatar for Vish0203
0
181
Member Avatar for sanjuktamuna

include<stdio.h> struct address{ char city[20],country[20],state[20]; }; struct customer{ int acount; char name[20]; float bal; struct address add; }; void display(struct customer * ,int); void main() { int i,size; printf("enter the number of customers"); scanf("%d",&size); struct customer cus[size]; struct customer * c[size]; for(i=0;i<size;i++) { printf("!"); scanf("%s",&cus[i].name); printf("!"); scanf("%d",&cus[i].acount); printf("!"); scanf("%f",&cus[i].bal); printf("!"); …

Member Avatar for Vish0203
0
165
Member Avatar for Infame

Hi! I'm currently making a HTTP protocol bot, it works somewhat fine with a fixed char array, but once there's a website that exeeds 8k, then it cuts off. If it's less, I get weird nonsenscial symbols... Is there a way to know the length before assiging the data to …

Member Avatar for Ancient Dragon
0
153
Member Avatar for MasterHacker110

i have this c++ code and i wondered how ot would be in c #include <vector> // for vector #include <sstream> // for stringstream #include <iostream> #include <string> using namespace std; int main() { stringstream ss; string input, temp; vector<string> comand; cout << ">: "; getline(cin, input); ss << input; …

Member Avatar for MasterHacker110
0
168
Member Avatar for janet@123

I am trying to use the glib HashTable implementation for my code and facing some issues in memory allocations. The code I've written is: GHashTable *g_hash_table; g_hash_table = g_hash_table_new (g_direct_hash, g_direct_equal); gint *port, *src_value, *value; guint32 *dst_key, *key; . . . while(1) { key = g_malloc (sizeof *key); dst_key = …

0
127
Member Avatar for bigzcoder

Hello, I am having trouble with my code. it does not seem to be comparing the two hands correctly I would really appreciate it if someone could take a look at it and tell me where i am going wrong. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define TOTAL_CARD_DECK …

Member Avatar for zeroliken
0
134
Member Avatar for Ankit_Parmar

#include <stdio.h> int main() { int a[0]; int b=2; printf("%X",a); return 0; } Where ever can we use 'a[0]' means array with index zero..

Member Avatar for rubberman
0
308
Member Avatar for jaymayne

**The program below wont run due to the following errors :** *MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup fatal error LNK1120: 1 unresolved externals* **Please help me to solve these errors.** #include<stdio.h> #include<conio.h> #include<Windows.h> int Choice=1; char opt; int ch=0; void Main() { while (ch!=4) …

Member Avatar for jaymayne
0
118
Member Avatar for iPanda

I got an assignment which I don't even know how to start, I have a path to a driver & its name (Argv) and I need to create a code that will install this driver automatically. If anyone even has an idea how to make this code generic I would …

Member Avatar for BobS0327
0
217
Member Avatar for sumi1234

I have an assignment question . We need to simulate FCFS scheduling algorithm using C on linux OS. This is what I need to do Write a program to simulate **FCFS scheduling algorithm** using pipes for inter process communication. 1. Let the parent program be the scheduler. 2. It takes …

Member Avatar for histrungalot
0
2K
Member Avatar for Daigan

int main() { float stud1[2], stud2[2], total1, total2, ave1, ave2; int x; char letter1, letter2,opt; do { system ("cls"); printf ("Enter the test scores for Student 1\n"); printf ("Test 1: "); scanf("%f", &stud1[0]); //Error checking, when the user inputs a value less than 0 or more than 100 if (stud1[0] …

Member Avatar for Ancient Dragon
0
214
Member Avatar for jara33

Hi, I need to do this program in my university and I was wondering how can I do it so that when there are no exits available, the program just says "type q to quite", and skips the 'Type the first letter of the next step or direction you want …

Member Avatar for zeroliken
0
157
Member Avatar for livesinabox

What I am supposed to do is create a C program which implements a "dumb" Sliding Window Protocol Implementing Client Server Program. First the client and server establish a connection between themselves and then the client sends "RST" to the server. The server inturn sends its window size (10) to …

0
154
Member Avatar for abhishekagrawal

Hi All, I have written a program to input a decimal string and convert it to character string. Below is my program: /*this program converts the decimal representation of an input string to character representation*/ #include<math.h> #include<stdio.h> #include<stdlib.h> char int2str(int n); int main() { int dec[100]={0},i,j,decindex,ndec=0,nchar; char character[100]={'\0'}; printf("Enter the …

Member Avatar for Ankit_Parmar
0
128
Member Avatar for _hp_

Does anyone knows how to assigned directly the sqlite query result to a struct in C rather that assigning to its members one by one? I have a table user_info with fields user_id, username, password. Also I have a struct st_user_info. typedef struct st_user_info{ int userId; char* userName; char* password; …

Member Avatar for Ancient Dragon
0
243
Member Avatar for shotgun2011

Hi everyone! This is the code that I have written in order to print a tic-tac-toe board. For example, if input was this: 1 2 0 1 1 2 0 2 0 The board would be this: X . O X X . O . O However, I don't know …

Member Avatar for Dani
0
146

The End.