473,500 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in adding array elements

Hi.
Pls help me i have the following code which is having error.This
program is being written by Visual studio 2005
Pls help me ASAP.
#include "stdafx.h"

void fun(int);
int arr[10] = {1,2,3,4,5,6,7,8,9,10};
int _tmain(int argc, _TCHAR* argv[])
{

fun(arr[0]);
return 0;
}
void fun(int *var)
{
int a = *(arr[0]+2);
int b = *(arr[0]+3);
int c;
c = a+b;
printf("\n %u",c);
}
Now the error is :
illegal indirection

Mar 23 '08 #1
1 1398
#include <stdio.h>

void fun(int);
int arr[10] = {1,2,3,4,5,6,7,8,9,10};
int main()
{

fun(arr[0]);
return 0;
}

void fun(int var)
{
int a = *(arr+2);
int b = *(arr+3);
int c;
c = a+b;
printf("\n %u",c);
}

-------------------------------------------------------
http://programmingsite.googlepages.com --- C Puzzles
Mar 24 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3596
by: David | last post by:
I have an array that contains numbers in string elements , i want to convert this to integers, i have made a for loop that uses the number of elements in the array and then adds 0, thereby...
6
3887
by: Naran Hirani | last post by:
Hi Guys and Gals, Please can u help me with this little problem. I am collecting a set of values from a web form and putting them into a JS array object. I now want to check/ensure that...
1
1135
by: H | last post by:
Ok, now this newbie is dealing with arrays. I have some questions on this. I thought I'd use the built in Array class, since it contains all I need for sorting, copying etc. arrays. Now I'm...
39
19552
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
7
1750
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
1
2041
by: DJG79 | last post by:
Hi all, I am using an open source menu that i found and it works great, except for one thing that when the web page is not scrolled to the very top the drop down links will not stay visible. Has...
11
3122
by: dennis.sprengers | last post by:
Consider the following multi-dimensional array: --------------------------- $arr = array( array(3, 5, 7, 9), array(2, 4, 6, 8), array(1, 3, 5, 7) ); function add_arrays($arr) { for ($row =...
12
1773
by: David | last post by:
Hi, I am trying to achieve the following: 1/ To have a standard form in an asp web page which has various check boxes and radio buttons. As a user selects a form item it updates a text box,...
2
3131
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
6
6542
by: santiago | last post by:
I guess one cannot do this: arraytot = arraytot + arraydet; So, what's the trick to adding arrays like this? Thanks.
0
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.