473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

what does possible use of 'i' before definition in C++?

what does possible use of 'i' before definition in C++?

Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4. int main()
  5. {
  6.  const int size= 10;
  7.  double a[size],b[size],c[size],d[size];
  8.  int i,larger;
  9.  
  10.  
  11.  cout<<"Enter your number: "<<endl;
  12.  cin>>a[i];
  13.  cin>>b[i];
  14.  
  15.  for(int i=0; i<10; i++)
  16.  {
  17.   c[i]=a[i]+b[i];
  18.  
  19.   cout<<"  "<<c[i]<<endl;
  20.  }
  21.    if(a[i]>b[i])
  22.       larger=a[i];
  23.   else
  24.       larger=b[i];
  25.  
  26.  
  27.  
  28.   larger=d[i];
  29.   cout<<" "<<d[i]<<endl;
  30.  
  31.   getch();
  32.  }
Dec 31 '15 #1
2 2875
weaknessforcats
9,208 Expert Mod 8TB
I'm not sure what you mean. Can you give an example from the code you posted?
Dec 31 '15 #2
donbock
2,426 Expert 2GB
Notice the "enter your number" block of code:
Expand|Select|Wrap|Line Numbers
  1. cout << "Enter your number:" << endl;
  2. cin >> a[i];
  3. cin >> b[i];
This block uses i as an array index before any value has been assigned to it.
Dec 31 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Steven T. Hatton | last post by:
I just read this in the description of how C++ is supposed to be implemented: "All external object and function references are resolved. Library components are linked to satisfy external...
1
by: seberino | last post by:
Python lets me access module level variables from *anywhere*. All I have to do is add module name in front. e.g. mymodule.myvariable Is this considered a 'global'? Or, does a 'global...
11
by: L. Chen | last post by:
The standard says that a char* or void* pointer has the least strict alignment. But I do not know what is a strict alignment. What does that mean?
2
by: Tom | last post by:
I'm getting this error when I try to pass a structure to a dll. An unhandled exception of type 'System.ArgumentException' occured in Test1.exe Additional Information: Type could not be marshaled...
4
by: **Developer** | last post by:
Using Shell32.FolderItem's IsBrowsable I find, for example, that Internet Explorer and Printers and Faxes are browsable. I studied Help to find the definition of Browsable but could not find it....
7
by: Jake Thompson | last post by:
What does SIMENTRY mean as in ULONG SIMENTRY RemoveFolderItem( hSession, pszFolderID, pszItemID, pAsyncCtl, pRC ) is it necessary?
21
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no...
10
by: _mario.lat | last post by:
hallo, what does it means "the function is not thread-safe"? thak you in advance, Mario.
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
3
by: qianz99 | last post by:
Hi I am not sure what this code does. I have the following questions 1. where is the case? 2. #define TLV_INTEGER(name, octets) p->name = -1; Is it define a function TLV_INTEGER(name, octets) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...

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.