473,395 Members | 1,530 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,395 software developers and data experts.

code

wat does this code do?
#include <stdlib.h>
#include <stdio.h>

int main( void )
{
int i, j, s[100];

int s_randomize(unsigned int s);

j = 1 + (rand() % 100);
printf( " %d\n", j );
return 0;
}
Mar 14 '07 #1
7 1153
RedSon
5,000 Expert 4TB
It probably does nothing good since s_randomize isnt a standard library call. Did you write s_randomize? How is it declared?
Mar 14 '07 #2
Banfa
9,065 Expert Mod 8TB
Like RedSon says s_randomize is not a standard library function but since you only declare it and don't call it that is not really relevent.

Since you call rand without seeding the random number generator my guess is that what this program does is print the same value every time you run it.

(On my system, VC++ 6, that just happens to be 42 :D )
Mar 14 '07 #3
RedSon
5,000 Expert 4TB
You lie like a rug! ROFL
Mar 14 '07 #4
Banfa
9,065 Expert Mod 8TB
You lie like a rug! ROFL
Hey, not fair. No lie told I compiled and ran that program at least 3 times all with the same result :p
Mar 14 '07 #5
RedSon
5,000 Expert 4TB
No this is the program you ran:

Expand|Select|Wrap|Line Numbers
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. int main( void )
  5. {
  6. int life, universe, everything[100];
  7.  
  8. int j = Exec("Deep Thought", life, universe, &everything);
  9.  
  10. j = 6 * 9;
  11. printf( " %d\n", j );
  12. return 0;
  13. }
  14.  
Don't try to fool me
Mar 14 '07 #6
Ganon11
3,652 Expert 2GB
Blasphemy!

(P.S. you define j as Exec(...) and then immediately reassign it to 6 * 9. Trying to double-cross Deep Thought!?)
Mar 14 '07 #7
RedSon
5,000 Expert 4TB
OMG!!!!!! there is an error in the code for the Second Most Powerful Computer ever created!
Mar 14 '07 #8

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

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
4
by: jason | last post by:
Hello. Newbie on SQL and suffering through this. I have two tables created as such: drop table table1; go drop table table2; go
16
by: Dario de Judicibus | last post by:
I'm getting crazy. Look at this code: #include <string.h> #include <stdio.h> #include <iostream.h> using namespace std ; char ini_code = {0xFF, 0xFE} ; char line_sep = {0x20, 0x28} ;
109
by: Andrew Thompson | last post by:
It seems most people get there JS off web sites, which is entirely logical. But it is also a great pity since most of that code is of such poor quality. I was looking through the JS FAQ for any...
5
by: ED | last post by:
I currently have vba code that ranks employees based on their average job time ordered by their region, zone, and job code. I currently have vba code that will cycle through a query and ranks each...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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.