Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-28-2006, 09:58 PM   #1 (permalink)
deepak_kr_mehta
Guest
 
Posts: n/a
Exclamation run time evaluated value to array

hello group members
sir i have taken print of const topic
one of problem in this topic is follows
<code>
#include<iostream>
using namespace std;
int main()
{
int s;
cout<<"enter the size";
cin>>s;
const int size=s;//run time evaluated value assign to compile time const size
int arr[size];//according to notes here will be error becz of run time evaluated
//value but the programme running successfully
//is it correct to say it will give problem plz exaplain me urgently

</code>
from
deepak kr.
  Reply With Quote
Old 04-28-2006, 10:13 PM   #2 (permalink)
AssKoala
Anti-Zealot
 
AssKoala's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 72
AssKoala is on a distinguished road
Send a message via AIM to AssKoala Send a message via MSN to AssKoala Send a message via Yahoo to AssKoala
Code:
int* arr = new int[size];
Or, more specifically:

Code:
#include<iostream>

using namespace std;

int main()
{
    int s;
    cout << "Enter the size";
    cin>>s;
    
    int* arr = new int[s];//according to notes here will be error becz of
    
    return 0;
}
You can use that const int size if you want, don't have to, depends on your style/program.
__________________
If you always think like an expert, you'll always be a beginner. | "A handful of knowledgeable people is more effective than an army of fools" -Writing Secure Code, 2nd Ed.
AssKoala is offline   Reply With Quote
Old 05-02-2006, 01:53 PM   #3 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Deepak, I've asked you before to use the code tags please. If you don't know how then communicate. I'll be glad (or anyone else) to assist you in using these tags.

See an example below my name... above the picture.
__________________
Valmont is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run time error lukmanpatel MS Technologies ( ASP, VB, C#, .NET ) 1 03-02-2006 05:54 AM
Time... horrible horrible time... joehouse MS Technologies ( ASP, VB, C#, .NET ) 1 11-23-2005 10:51 AM
Simple reverse programm silex Standard C, C++ 3 01-22-2005 09:03 AM


All times are GMT -8. The time now is 04:12 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting