210 Topics

Member Avatar for
Member Avatar for pheonixkid

Hi, i'm trying to make 3 different input scenarios using argv. In the code below where there is just one input so when it is argv[0] the calendar for this month comes up, when it is argv[1] so when there are two inputs, it will printout the calendar for the …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for sing1006

#include <stdio.h> #include <stdlib.h> double average(int arrx[6], int *ptr); int main(void){ int arry[6]= {2,5,4,5,6,7}; int count=0; double avg; avg=average(arry,&count); printf("The average is %.2f\n",avg); printf("Number bigger than average is %i", count); return 0; } double average(int arrx[6], int *ptr){ int c=0; int sum=0; double a=0; for(c=0;c<6;c++){ sum=(double)sum+arrx[c]; } a=sum/6; for(c=0;c<6;c++){ if(arrx[c]>a){ …

Member Avatar for Moschops
0
183
Member Avatar for suhasgh

Hi, i'm trying to delete last node of linked list and print the remaining list at each step. for this i created 'Print' function. please take a look at this code: struct Node{ int data; Node *next; }; void Print(Node *head){ if(head==0) return; else{ Node *temp=head; Node *prev=head; while(temp!= NULL){ …

Member Avatar for ookhan
0
180
Member Avatar for Start4me

Hello everybody! I’m trying to create a program in which the user has the ability to move the image with mouse click and ability to zoom in and out by scrolling the mouse wheel. If the user wants to return to the original image size and position, it will be …

Member Avatar for Start4me
0
1K
Member Avatar for usama sadaqat

#include "stdafx.h" #include<iostream> #include<conio.h> #include<ctime> using namespace std; int *p[10][20];// int _tmain(int argc, _TCHAR* argv[]) { cout<<sizeof(*p)<<endl; getch(); return 0; } output: 80 but i cannot understand how it work.

Member Avatar for sepp2k
0
151
Member Avatar for hassje

#include<stdio.h> #include<conio.h> #include<string.h> struct student { int*ptr[23]; char*name[12];//store address of character string }s1; void main() { int roll=20; //char n='s'; s1.ptr=&roll;//ERROR s1.name="zahid ali";//ERROR printf("roll no of student :%d\n",*s1.ptr); printf("name of student:%s\n",s1.name); getch(); }//plase coorect this error

Member Avatar for rustysynate
0
157
Member Avatar for Mantroskylo

This is an assingment i've been working on but since this is a merge between two previous developments i need a little help solving my issue here that would be highly appreciated. In a nutshell what this program needs to do is recieve a .txt file create a vector holding …

Member Avatar for rubberman
0
287
Member Avatar for Angelrawzz

Hi, I am trying to create a function which takes two chars and a char* string. Then run the function and replace each occurence of Char1 with char 2. E.g. String = Apples. Char 1 = A. Char 2 = B. Char 1 is present in string so replace all …

Member Avatar for deceptikon
0
602
Member Avatar for n1csaf3

I am trying to work out how to pass a pointer from my C# interface application to the C++ back-end functionality DLL. I tried searching Google but can't work out what I'm doing wrong.. I'm used to using * for pointers and just changing the value in the pointer through …

Member Avatar for deceptikon
1
588
Member Avatar for ncauchi

I am new to C and am trying to read the characters in a string serially but I keep getting the error > makes pointer from integer without a cast This is my code void UART1PutChar(char Ch) { //char data; //transmit only if Tx buffer is empty while(U1STAbits.UTXBF ==1); U1TXREG …

Member Avatar for ncauchi
0
214
Member Avatar for robgeek

Hey everyone, I was attempting to get the lastmodified file from a folder, and to do so I used File.listFiles() method which is returning a null pointer exception even though the folder is not empty. I had this piece of code working about two days ago and I am not …

Member Avatar for sirlink99
0
8K
Member Avatar for MRehanQadri

char* f(){ char* result;//I have to return 'result' at the end of this function, where result should be containing i (i.e. int i=97) in it. int i = 97; //Do whatever you can return result; }

Member Avatar for Ancient Dragon
0
398
Member Avatar for gobiking

Hello, I made a program that worked perfectly on one of my pcs. When I moved it to another computer I am getting an error now stating that I need to include a pointer on my fmin and fmax functions. I'ts somewhat lengthy but I want to know if maybe …

Member Avatar for gobiking
0
330
Member Avatar for elattar

I need to make program that calculate multiplication of matrice i made it in main now i need to make it in functions would anybody hepl me with my problem that is my code #include <iostream> using namespace std; #include <cstdlib> void fn(int **arr) { } void fn2 (int **arr2){ …

Member Avatar for elattar
0
166
Member Avatar for bluekb

#include <stdio.h> #include <stdlib.h> #include <string.h> #include "queue.h" #include "stack.h" #define NAME_SIZE 20 #define RECORDS_SIZE 100 typedef struct { char studName[20]; int timeEnter; int timeUpdate; }STUDENT; typedef struct { char tutorName[NAME_SIZE]; int tutorTime; STUDENT *ptr; }TUTOR; QUEUE *queue1; STACK *stack1; void getData(STUDENT *studArr[], TUTOR tutorArr[1]); int main(void) { STUDENT *studArr[RECORDS_SIZE]; …

Member Avatar for bluekb
0
346
Member Avatar for Lakhan Thakur
Member Avatar for achava

How do I define a typedef struct in function f1() and pass a pointer to function f2() without a global definition of the struct. For instance: Also I would like this to be in C but not in C++. I have no toolbar, so I cannot put the code I …

Member Avatar for Ancient Dragon
0
210
Member Avatar for kw42chan

Hi, I have some questions about type check warning. I am reading the tutorial notes from [Click Here](www.clear.rice.edu/comp221/html/pdf/03-arrays-pointers.pdf) CASE 1 int int1 = 1036; /* some data to point to */ int int2 = 8; int *int_ptr1 = &int1; /* get addresses of data */ int *int_ptr2 = &int2; *int_ptr1 …

Member Avatar for owenransen
0
189
Member Avatar for group256

Hi everyone, I have the implementation for a linked-list based Stack. I believe the entire code is correct, but only the way I call the push and pop function mighe be wrong. Any idea how they should be called? Mine returns garbage: #include <iostream> using namespace std; typedef struct Elements …

Member Avatar for deceptikon
0
280
Member Avatar for otengkwaku
Member Avatar for otengkwaku
1
392
Member Avatar for tofumaker

int x = 0; int i,j,p; int buf[4]; int *array[5] = {0}; for (j = 0; j < 3; j++){ for (i = 0; i <4; i++) { buf[i] = x++; } array[j] = buf; } int* temp; temp = array[1]; for (i = 0; i<4; i++) { printf("%d\n", *temp); …

Member Avatar for deceptikon
0
156
Member Avatar for ram619

This code is crashing, please tell me for what all I need to assign memory. Thanks #include<stdio.h> #include<conio.h> #include<stdlib.h> struct s1 { char *p1; }; struct s2 { struct s1 *p2; }; struct s3 { struct s2 *p3; }*p4=NULL; int main() { char a='a'; p4=malloc(sizeof(struct s3)); p4->p3->p2->p1=&a; printf("%c",*(p4->p3->p2->p1)); return 0; …

Member Avatar for ram619
0
126
Member Avatar for ehsann.sharif

**guys I wrote this, there's no errors, no warnings... but it keeps crashing on execution.. any ideas ?????** #include <stdio.h> #include <stdlib.h> #include <string.h> struct data { char * name ; int grade ; }; int compare_ints(const void *a, const void *b); int compare_strings(const void *x, const void *y); struct …

Member Avatar for Ancient Dragon
0
196
Member Avatar for johnandersen24

The function i am writing below is made to time how long it takes to process a function. // return type for func(pointer to func)(parameters for func), container eg.vector clock_t timeFuction(double(*f)(vector<double>), vector<double> v) { auto start = clock(); f(v); return clock() - start; } This is the function i want …

Member Avatar for mike_2000_17
0
655
Member Avatar for sblass92

I'm setting up a finite state machine structure as a proof of concept to be used in other projects. The states have function pointers that point to actions they are allowed to perform during certain events and transitions. I'm trying to restrict these pointers to be a part of a …

Member Avatar for sblass92
0
2K
Member Avatar for James19142

I used `memcpy` to copy the contents of one pointer to another pointer assigned to new memory. Later in the program I get runtime errors as if I were attempting to operate on a pointer pointing to nothing. While debugging, I saw that the original and the the copied pointer …

Member Avatar for James19142
0
2K
Member Avatar for AndrewEPage

Just a thought that woke me up this morning. A means of providing 'property' type constructs in C++ classes similar to python properties. # Header # #ifndef _HXX_CPROP #define _HXX_CPROP /** * Helper class to connect a 'property' in a * c++ class to getter/setter methods * */ template<class T, …

Member Avatar for mrnutty
0
3K
Member Avatar for proprogrammer
Member Avatar for danielkull

Hi, I have a function which returns a pointer to array with data: `float * EZ_MATH::EZ_GE_BY_ME() { ... }` Now, how can I access this data? This doesnt work: `float * memA = temp_m.EZ_MATH::EZ_GE_BY_ME();` `ofstream output("out_file", ios::out);` `output << memA[0] <<endl;` `output << memA[1] <<endl;` Help!

Member Avatar for ravenous
0
284
Member Avatar for thinkaboutyoueveryday

`Inline Code Example Here`**I REVISED MY PROGRAM** #include <iostream> #include <cmath> using namespace std; int main () { const int num=100; float volt[num], sum=0, sum2=0 ; double ave2,standrddev1, standrddev2, standrddev; float average; int i, k=0 ; { cout<<"Enter the number of voltages to be analyzed:"; cin>>k; if (k>100) { cout<<"Maximum …

Member Avatar for NP-complete
0
194

The End.