15,551 Topics

Member Avatar for
Member Avatar for willyah

Am a beginner in C programme. How do I define two vectors of complex numbers with random valuee of size N. appling this code complex*vector=(complex*) malloc(sizeof(complex)*N)

Member Avatar for rubberman
0
158
Member Avatar for willyah

How can write a paralle program using the openmp threading library(omp.h) to calculate the time needed to calculate the dot product of two vectors.

Member Avatar for Ancient Dragon
0
184
Member Avatar for CHINMAYA_1

main() { int s=0; while(a && b && c) { s++; a--; b--; c--; } printf("%d",s); } i know that here a,b,c are undeclared, but beside that i can't find the problem. so anyone can help me out here. thanks

Member Avatar for rubberman
0
119
Member Avatar for willyah

Am beginner in C program how can i write a sequential program to calculate the wall clock time (time_t) needed to calculate the dot product of two vectors.

Member Avatar for rubberman
0
80
Member Avatar for radu.nuconteaza

//header file #ifndef STRUCT_H_INCLUDED #define STRUCT_H_INCLUDED typedef struct curs_valutar { char nume[50]; float cursul; struct curs_valutar* next; struct curs_valutar* next2; }curs_val; curs_val *head=NULL; int sc=0; int n; int creare(int n); void introducere_date(); int citire_date_fisier(char nume_fisier[100]); void afisare_date(); void eliberare_memorie(); int adaugare_date(char c_nume[100],float cursul); void cautare_date(char sir[100]); void cautare_date_in(int val1, int …

Member Avatar for Ancient Dragon
0
223
Member Avatar for Vish0203

Hi everyone, I know that we can pass string as command line argument and use it as we want. But, can we pass a text like "this or that" (with several spaces)?? Is there any way??

Member Avatar for Vish0203
0
93
Member Avatar for V3N0M

Hi everyone can anyone help me debug this code apparently it works on my mac and doesnt work on windows and codepad.org. Thanks in advance: //Tic_Tac_Toe game #include <stdio.h> #include <stdlib.h> /************************************ function prototype ***********************************/ void displayBoard(); int verifySelection(int, int); void checkForWin(); /************************ gloobal variables ***********************/ char board[9]; char cWhoWon …

Member Avatar for V3N0M
0
309
Member Avatar for bogoreh

hi everyone i am trying to write a program for a library system that allow stuff to add, remove, view and delete customer. i try to use file to store data and i open the file in mode read then i store then i put the content of the file …

Member Avatar for bogoreh
0
186
Member Avatar for Rahul47

Here is my nifty program. #include<stdio.h> int main(){ char *str; str="Hello World!!"; puts(str); printf("\nEnter a new string: "); gets(str); // Is this right ? printf("\nString after entering: "); puts(str); // And this one ? getch(); return 0; } The program did printed "Hello World!!" but failed to take user input.

Member Avatar for Ancient Dragon
0
224
Member Avatar for aka619ASH

So the question is following: Given three integers as input determine if the values were entered in ascending order (from smallest to largest) and whether those values represent a Pythagorean Triplet.[Click Here](http://en.wikipedia.org/wiki/Pythagorean_triple) **Examples** *Enter the three values to test (a b c): 3 4 5 a < b < c …

Member Avatar for scudzilla
0
226
Member Avatar for momal

This is my question and I've managed to bring out an answer for part a, but for part b I'm not really confident about my answer of part b. In a recent court case, a judge cited a city for contempt and ordered a fine of $2 for the first …

Member Avatar for momal
0
2K
Member Avatar for Rahul47

Here is my code along with question in it. #include<stdio.h> int main(){ int i,a[2][3]={{1,2,3},{4,5,6}},*p=&a; printf("%d",p); // Printing the base value. printf("\n%d",p[4]); // Q) Does this means *(p + 4) ? printf("\n%d",p[5]); // Q) Does this means *(p + 5) ? getch(); return 0; }

Member Avatar for Rahul47
1
200
Member Avatar for dendenny01

How can I dynamically allocate the size of an arry at runtime When I am doing this am getting an error.. #include<conio.h> #include<stdio.h> void main() { int n; a[n]; clrscr(); printf("Enter no of your array\n"); scanf("%d",&n); printf("Enter your array"); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) { printf("%d\n",a[i]); } }

Member Avatar for dendenny01
0
343
Member Avatar for vibhu mishra

i m trying to run a mp3 file on dosbox plateform by c .i put the following code in to the batch file start c:\xyz.mp3 and trying to call this as system("c:/a.bat"), the system funtion is returing 0 but it is not running it. But the same code working well …

Member Avatar for cgeier
0
341
Member Avatar for arlir

Hi there every body, i am trying to build this contact list to hold records for a purpoted library but i got a little stuck with a few issues that i would like you guys to look at. The fifth switch(delete) statement does behave strangely i should say. When I …

0
75
Member Avatar for arlir

Hi there every body, i am trying to build this contact list to hold records for a purpoted library but i got a little stuck with a few issues that i would like you guys to look at. The fifth switch(delete) statement does behave strangely i should say. When I …

0
81
Member Avatar for arlir

Hi there every body, i am trying to build this contact list to hold records for a purpoted library but i got a little stuck with a few issues that i would like you guys to look at. The fifth switch(delete) statement does behave strangely i should say. When I …

0
49
Member Avatar for overwraith

Is there any difference between returning a pointer to a struct, and returning a struct? Aside from the derefrenceing that is done would they both be working with the same struct? Is there any copying that gets done if it is just a regular return?

Member Avatar for overwraith
0
301
Member Avatar for Rahul47

I have two questions: 1) Here is a small program showing how one can use Array name as Pointer variable. #include<stdio.h> int main(){ int a[5]={1,2,3,4,5},i=0; for(i=0; i<5; i++){ printf("\nAddress: %d\tValue: %d", a+i,*(a+i)); } getch(); return 0; } If we can use array name as pointer variable, then why separately declare …

Member Avatar for Banfa
0
201
Member Avatar for Rahul47

Which one of the following is the smart, efficient and safe way to declare a string array ? And if you have any other way do suggest. char a[10]={'A','B','C'}; char a[10]="ABC"; char a[]="ABC"; char *a="ABC"; Please take into consideration the memory allocation and size, memory wasted, methods of retriving data …

Member Avatar for mathematician
0
128
Member Avatar for Rahul47

Fairly easy pointer increment program is as follows. #include<stdio.h> int main(){ int i,a[10],*p=a; for (i=0; i<10; i++,p++){ printf("\nAddress of a[%d] is %d",i,p); } getch(); return 0; } Here is output: Address of a[0] is 2293488 Address of a[1] is 2293492 Address of a[2] is 2293496 Address of a[3] is 2293500 …

Member Avatar for Ancient Dragon
0
228
Member Avatar for H_beginner

I am using the gcc compiler and I am new to using flags. Can any one tell me a source for it. e.g. I wanted to use *-funroll-loops* but I dont know the proper syntax. Can any one help.

Member Avatar for L7Sqr
0
245
Member Avatar for Rahul47

The expected outcome dosent agree with result. Following is the code snippet. int a,c; a=10; c=0; c=(--a)+(--a); printf("C: %d", c); printf("\nValue of a: %d", a); I expected C to be 17 i.e (9+8), but it comes out to be 16. And a becomes 8 as expected. When expression is changed …

Member Avatar for N1GHTS
0
410
Member Avatar for V3N0M

Hi there I am currently teaching myself C and I have to create a program with a 2d array that receives upto 5 names and prints them out. No pointers should be used :(. So I am wondering can anybody help me with this. #include <stdio.h> int main(int argc, const …

Member Avatar for V3N0M
0
145
Member Avatar for Oremuss

Hi guys , I have to do simple brute force program for my homework and I dont know what to do. It should work when I put there some password(max. 4 letters for examle: azxd ) and the program should start to trying every possible combination one at time like …

Member Avatar for Oremuss
0
207
Member Avatar for H_beginner

Can anyone please tell me how can I do loop unroll void do_block (int lda, int M, int N, int K, double* A, double* B, double* C) { /* For each row i of A */ for (int i = 0; i < M; ++i) /* For each column j …

Member Avatar for H_beginner
0
291
Member Avatar for shakin

** # import a data table with space? # ** Good day! I need to read in all the data in a file within column two and export it in a file. The issue is the data is not standard and has blank fields from time to time. It also …

Member Avatar for N1GHTS
0
257
Member Avatar for kristina.densmore

I just started programming in C our first asssignment is writing an alogrithm to compute the volume of water in cubic feet, flowing through a pipe of diameter d in feet, with a velocity of v feet per second, give this fomula r=d/2 area=pi x r squared volume = area …

Member Avatar for cgeier
0
470
Member Avatar for shaneetra.graham

I'm buidling my own shell and I was trying to implement a history function, but was a little lost on where to start. I know i would like to use a for loop to go through list, I'm just having trouble on where to store it.

Member Avatar for N1GHTS
0
126
Member Avatar for radu.nuconteaza

#include <stdio.h> #include <conio.h> #include <stdlib.h> struct exchange_rate { char name[50]; float rate; }; int main() {struct exchange_rate x[50],adaus,caut[20],aranj; int i,n,q,k,z,d; float aux,max; char w; int lungime; FILE *f1; //afisam meniul m0: system("cls"); printf("\n\t\t***MENIU***\n\n"); printf("\t1: Filling database.\n"); printf("\t2: Reading the database file\n"); printf("\t3: Introducing a new registration\n"); printf ("\t4: Cautarea …

0
109

The End.