15,551 Topics
| |
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) | |
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. | |
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 | |
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. | |
//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 … | |
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?? | |
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 … | |
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 … | |
| 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. |
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 … | |
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 … | |
| 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; } |
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]); } } | |
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 … | |
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 … | |
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 … | |
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 … | |
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? | |
| 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 … |
| 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 … |
| 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 … |
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. | |
| 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 … |
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 … | |
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 … | |
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 … | |
** # 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 … | |
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 … | |
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. | |
#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 … |
The End.