210 Topics

Member Avatar for
Member Avatar for baby_c

please anyone help me to catch this.i tried to return an array from function and access it within main function.i just got a warning [CODE]"function returns address of local variable "[/CODE] and when i execute the program it gives garbage values as array elements..cam you help me pls... [CODE]#include<stdio.h> int …

Member Avatar for baby_c
0
141
Member Avatar for andrewjad

here's my code: [CODE=C++] #include <iostream> using namespace std; void func(int num) { num = num + 1; cout << num; } int main() { int num2 = 5; cout << num2; func(num2); cout << num2; func(num2); cout << endl << endl; system("PAUSE"); }[/CODE] when the program runs, it yields …

Member Avatar for andrewjad
0
191
Member Avatar for z_a

While reading Stroustrup's "The C++ programming language", I was puzzled at 'declaring a pointer to an array of character strings and declaring a reference to an array of 10 integers', and I had to clear my mind on pointers to arrays. I am posting here the notes I made to …

Member Avatar for z_a
0
435
Member Avatar for bawbawbiscuit

Hi, I created a program that makes a multiplication table, I dont know where the .txt file is located after executing the program Im using turbo C++ :-/ [CODE]#include<iostream.h> #include<stdio.h> void main(){ int multiplicand; int multiplier; int toprow; int column; int repeater; FILE* Starter=fopen("[COLOR="Red"]multiplication.txt[/COLOR]","w"); cout<<"Insert the number of repetitions: "; …

Member Avatar for bawbawbiscuit
0
101
Member Avatar for hamza123

My question is that what is the effect if I delete a pointer in a linked list by mistake??? What problems will arise and how will I come to know that is a missing pointer that is causing the trouble?

Member Avatar for hamza123
0
94
Member Avatar for yuri1969

My func looks like: [CODE]int pop(node **hd, char **new_element) { node *dummy; int i = 0; if (empty(*hd) == 1) { printf("Stack is empty"); return -1; } else { (*new_element)[i] = (*hd)->element[i]; // problem is here ;) dummy = *hd; *hd = (*hd)->next; free(dummy); }[/CODE] and I call it via: …

Member Avatar for yuri1969
0
124
Member Avatar for ehsantl

Hi guys I'm struggling to write a code for traversing a directed graph. It contains City as nodes. I'm trying to put City(s) to a LinkedList and then work with them to find the path. However, as you will notice I'm still newbie in C++. I have a *nextcities as …

Member Avatar for alwaysLearning0
0
134
Member Avatar for Knome

I've searched all over google and this site. I've found a few hints here and there but after i make the changes either my compiler throws a fit or it doesn't produce the desired results. Here's what i want: I want to create a linked list in the main function …

Member Avatar for Martin B
0
4K
Member Avatar for Goshutu

Hi,I have tried to get this program to work,but it works to the moment when you enter some of the array`s numbers and then crashes.In different sizes of the matrix you can enter different number of numbers,but for instance when the matrix is 5x5 the program crashes after the 11th …

Member Avatar for Goshutu
0
437
Member Avatar for NotAround

I'm rather new to the C programming language and I'm very stuck. Whenever I try to assign a value to dynamically allocated string, I end up with a Segmentation Fault. Could someone help me by explaining why this happens. Following is a bit of my code that I think should …

Member Avatar for gerard4143
0
127
Member Avatar for morrock

I'm currently practicing algorithms and coding for my colleges programming team. The problem is, in High School I was almost purely C/C++, while my college team all work in Java. So, while not wildly different, learning Java is still pretty frustrating to me. My most recent problem is a Java.lang.NullPointerException …

Member Avatar for vasu d
0
193
Member Avatar for saransh60

I did'nt understand here in this code i was reading a book and then const char *q="Hello"; //string is fixed pointer is not *q='M'// error q="bye"; //works char * const t="Hello"; //string is fixed pointer is not *t='M'// works t="bye"; //error so my question is in first if string is …

Member Avatar for nbaztec
0
96
Member Avatar for neoraghav

Hi, I'm new to pointers. i got some requirements...... Following is my requirement.........i want to use a double and triple pointer array [2D,3D] and in that double pointer i want to get data from the user.how can i achieve that using malloc and free for assigning and deallocating memory. im …

Member Avatar for mike_2000_17
0
2K
Member Avatar for ehsantl

Hi guys I'm trying to finish my assignment, I stuck in a weird situation. I'm trying to create a pointer a linkedlist. This linkedlist contains pointer to a user-defined objects (City) and I'm trying to add City to this linkedlist and then iterate through the linked list to find and …

Member Avatar for ehsantl
0
168
Member Avatar for guru_iyer

I'm trying to do addition of matrices using pointers. But, in 3x3 matrix, only the first row of the matrix gets added, while the rest are zero. Please help me correct this. Thank You! My code is as follows :: [CODE] #include<stdio.h> #include<conio.h> int a[10][10],b[10][10],c[10][10]={0}; int i=0,j=0,k=0; int r1,c1,r2,c2; void …

Member Avatar for Adak
0
3K
Member Avatar for george61

Ok I have a linked list which have to read from binary file and to write in binary files. This is the function about the reading from keyboard: [CODE]short readElement( Node * newE) { int b,e,m; if ( newE == NULL ) return 1; do { printf("\n Registration number:"); scanf("%s", …

Member Avatar for prvnkmr449
0
3K
Member Avatar for pleasecompile

Hello, can someone please assist with my application... An automation system collects 512 measurement points per sensor. Each measurement point has dedicated OPC tag which I can read using OpenOPC for Python. However, with multiple sensors, the OPC server can lag. So, the automation system programmer created an "array of …

Member Avatar for pleasecompile
0
436
Member Avatar for ehsantl

Hi folks I'm trying to do my assignment in c++, I suppose to develope a maze traversal using backtracking algorithm. I have to write a constructor for my Maze with this sign. [CODE]Maze(**c, int size); [/CODE] which takes a n-by-n two-dimensional character array. Can you guide how can pass an …

Member Avatar for mrnutty
0
795
Member Avatar for 344server

Hello List, I'm creating a Button where I want to add a function setActionOnReleased(func aFunction); From any class I'd like to instantiate this Button class and send it the function I want to execute. I found some reference to using member function pointers ( [url]http://bytes.com/topic/c/answers/569262-passing-function-argument[/url] ), but I'd like to …

Member Avatar for 344server
0
249
Member Avatar for Rez11

EDIT: I figured it out. I do not know how to delete threads. Sorry. I need to return a pointer to a new array. The new array must be the same as the old one, just in reverse. I have it all done except for one little part. I can't …

Member Avatar for Rez11
0
118
Member Avatar for Garrett2011

Suppose we've got two integer and character variables: [CODE]int adad=12345; char character;[/CODE] Assuming we're discussing a platform in which, length of an integer variable is longer than or equal to three bytes, I want to access third byte of this integer and put it in the character variable, with that …

Member Avatar for r.evrard
0
210
Member Avatar for new_programmer

What is the difference between pointer and reference Please explain in detail. I want its full concept , so pls explain in detail

Member Avatar for daviddoria
0
91
Member Avatar for crodriguez08

Hey there, I'm having trouble getting my program to display the students and class summary using classes. What I'm unsure of is where the problem lies, whether it is a displacement of set/get functions or the content in my StoreStudent function is incorrect, or perhaps something else I might have …

Member Avatar for mike_2000_17
0
374
Member Avatar for dragontruong

I have an assignment that requires me to not use an array with [] at all throughout my code, read a file in a certain way, and I need a better understanding with malloc as well with pointers. The code with the [] is pretty easy for me, but pointers …

Member Avatar for jihan sultana
0
158
Member Avatar for saransh60

#include<iostream> #include<string.h> int main() { char* str="my name"; /*plz explain what is pointer-name,and what is string- name here(realy confused) ? i am new to pointers :) */ int len=strlen(str); char* ptr; ptr=new char[len+1]; /*is this ptr pointer or string*/ strcpy(ptr,str); cout<<ptr; delete ptr; /*how this works */ cout<<endl<<ptr; /*this 'ptr' …

Member Avatar for Fbody
0
130
Member Avatar for parisa_bala

Hi, I am developing a large scale code. In order to save the space, when I declare any pointer, I allocate it in another subroutine. Now it seems that it does not work when I use an array of pointers. I can summarize the code as: [CODE] #include "headers.h" /** …

Member Avatar for Banfa
0
168
Member Avatar for Empireryan

OK, I've got a [90][10] 2d array. I have a set of pointers that point to the values in the array by column. each column holds different info. It's a payroll file so the zero column of my array corresponds to an employee number. What I want to do is …

Member Avatar for NathanOliver
0
102
Member Avatar for Zcool31

Hey all! I'm writing a simple fluid game in C++, and I've come across a strange issue. I allocate a whole bunch of arrays of float for use in simulations. During the course of the program, nothing goes wrong. But when I try to delete the arrays, I get a …

Member Avatar for Zcool31
0
3K
Member Avatar for corby

In my experiment.cpp i have Test *tests[maxTests]; as private data. How do i access this in my runExperiment function to call functions from the test class or its derived classes?

Member Avatar for corby
0
117
Member Avatar for habib_parisa

Dear All, I am trying to use free function in C to free memory of an array of pointers. It does not work and I get segmentation fault. The code looks like this: [CODE] #include <stdio.h> #include <stdlib.h> int main() { int *make_pointer(int); void read_array(int *array[3]); /****************/ int *array[3] ; …

Member Avatar for jephthah
0
6K

The End.