aaaa12345
It will Show Error u201cmain must return intu201dLike any other function, main is also a function but with a special characteristic that the program execution always starts from the u2018mainu2019. u2018intu2019 and u2018voidu2019 are its return type.void main u2013 The ANSI standard says "no" to the u2018void mainu2019 and thus using it can be considered wrong.
One should stop using the u2018void mainu2019 if doing so.int main u2013 u2018int mainu2019 means that our function needs to return some integer at the end of the execution and we do so by returning 0 at the end of the program. 0 is the standard for the u201csuccessful execution of the programu201d.
main u2013 In C89, the unspecified return type defaults to int. So, main is equivalent to int main in C89. But in C99, this is not allowed and thus one must use int main.
So, the preferred way is int main. If we replace void main () with int main()The output is helloIn the second line u201cif(true);u201d has no effect because it ends with ; that means the line ends there and it does not makes any decision on printf.so it prints hello
· Other Questions
What is the output for int num10;main() int num20; printf ("%d ",num); printf (" %d", num);?
If your program is like this:#include
Here the preference is given to the local variable value i.e., num20.
So the output will be obtained as 20 20.Or else if your program is like below:#include
e. , only small block of statements) but not entire main() function. The scope of local variable delcaration is within the block but when the compiler reaches the next statement after the block the value of "num" will be updated to 10 which is initialized globally.
Hence the output will be 20 10Hope this helps.
------
Why do dogs jump up on people to greet them?
I can only answer for my dogs (they trained me!
). For the lab, itu2019s the beginning of the u201chappy danceu201d where she gets up on her hind legs & does a little jig. If you lean down into her, sheu2019ll lick your face & lean into you.
The hound puppy is just exuberant, but, again, if you crouch down to her level, sheu2019ll lick your face & jump all over you excitedly. Weu2019re working on u201cgood greetsu201d a/k/a u201cfour on the flooru201d where we try to keep them from jumping - sniffing is okay. (any dog trainers out there that can offer some reinforcing techniques?
Works well with treats, hardly at all with voice). I read somewhere that puppies greet their mothers by smelling their mouths to see if theyu2019ve been eating and/or have brought something to eat back to their litter. Perhaps this would explain it, too.
I also wonder if they jump because they want to get closer to your face. Dogs look at our faces for direction, to gauge our emotions, to read us. Iu2019ve also seen theories that itu2019s for dominance.
I donu2019t think this is the case in my house, but, knowing dogs & what can motivate their behaviors, I wouldnu2019t discount it
------
Do you ever get these weird moments where you think, "This is real life?"?
Not sure about the dizzy part, maybe surreal feelings at times about the nature of life.
I remember feeling sort of weird when I was younger and just thinking, "wow what a crazy thing that I am a living creature, a human capable of rational thought and self-awareness." Not necessarily those exact words, but in essence that thinking.I can still "choose" to feel that way right now, but it doesn't feel so weird.
I can sit here, perhaps stare at my hand flexing open and closed and think, "Wow, life is such a crazy thing. Here I am a real person answering questions on the website Quora."I won't get into detail, but I happen to believe in God, partly as a consequence of these types of things, but it life perhaps be even more amazing without God.
If a godless world started by the Big Bang resulted in this universe, and the elements that now make up my body flying billions of miles to this corner of the universe and somehow a "spark of life" resulting that in this combination of elements fused together to come alive eventually resulting in me, and me sitting here as a living creature possibly aware of how I came to be a living thing? Mind-blowing, that's what it is. (or maybe God did it, but still life is surreal even in that case)
------
Who wrote the first computer program?
The problem with your deceptively simple question is one of definitions. You are likely to get a huge variety of answers. I am going to give you one of the standard ones: Lady Ada Lovelace (https://en.
wikipedia. org/wiki/Ada_Lovelace)There will be others who disagree with my answer, though. For a start, she never had a working piece of hardware (a digital mechanical computer) on which to test her software for bugs.
There is also some people who question how much of her writings were originated by her. There are some people, therefore, who will give you names of later people, programming later successful digital electronic computers. In general, of course, *all* designers of digital electronic computer would have had to have dabbled in writing programs for their designs.
In the other direction, there are some people who would say that Lady Ada was predated by examples of pre-programming in ancient Greece (https://en. wikipedia. org/wiki/Automaton#Ancient).
These devices, where real, were not general purpose computers, but still needed to have programs prepared for them. So, they are excluded since you ask for "the first computer program", but might not have been if you had just asked for "the first program".The above post expresses the author's personal opinion, not those of his employer.
------
What is the best iPhone app for learning or studying Chinese?
I think there are a number of top iPhone apps for learning Chinese. For dictionaries: Pleco's dictionary, as always, is quality.
They have a free version with add-ons you can purchase. Their new "shoot and translate" feature, which allows you to translate physical documents and the like is pretty ground-breaking. I personally use Qingwen regularly, as it also has word list where you can save vocabulary into categories.
For reading Chinese, ChinesePod's "Learn Chinese" app is fantastic (for full access you need to be a Premium user or above). You can access all lessons from their site, go through dialogues, expansion sentences, vocab - and then save words onto your flashcards. (disclaimer: I used to work for ChinesePod)I have tried some other apps, from ILL, byki and others, but most are targeted towards beginners only (the 3 apps mentioned above can be used by all levels), and some have very limited functionality.
Some of the new apps I am looking forward to using are from Nciku, who have launched a number recently, and popupchinese. com, who have a reading app (popupchinese have a very good tool for reading the latest news in a convenient way - www.newsinchinese.
com)So, as you can see there are a number of different options, and most likely, you will need a combination of apps if you are looking to improve your overall Chinese
------
How do I print without spaces in python?
Just use - print("Hello", end"n")EXPLAINATION:In python print() functions prints to standard output. Print function can take multiple arguments.
First argument is the variable or any value we want to print. >>> print("Hello")Hello>>>Above example prints Hello String but you are getting an extra newlines. Now lets come to your question-There is another argument end which is by default a newline.
That means every time print() function is called a newline printed. So the above code will actually be->>> print("Hello", end"n")Hello>>>we donu2019t mention endu201cnu201d because itu2019s already the same by default and this causes the the line at the end. We can explicitly change end argument.
nSuppose we need space then we will type end u201c u201d that means we need a blank space at the end. I think you already got the answer. You have to put end u201cu201d .
So the code islst 1, 2, 3for item in a: print(i, end"") # end holds the value of newline or space PS: If you are using Python 2. x then you have print statement instead of print() function so you should add the following line above the codefrom __future__ import print_function
------
How can I start in quantum computing programming?
Try this link it shows how to use the IBM Q SDK .
There all in Python so I think you will be fine. Okay but first you should be familiar with Quantum computing concepts download the following book . The purpose of this book is to make this exciting research area accessible to a broad audience.
One advantage of dealing only with theory, and not with the efforts to build quantum computers, is that the amount of quantum physics and supporting mathematics needed is reduced. You should be able to develop all of the necessary quantum mechanics within the book. Read the book slowly and try to get as much as you can out of it, make sure you know about Quantum Computers inside and out.
Quantum computers are a weird new kind of computer. They burn through unthinkable numbers of parallel universes to run programs faster, and use principles that confounded even Einstein. They are the magical miracle boxes that will leave your stupid boxes of transistors in the dust.
Certainly not something for the wider programming public to concern themselves with! I donu2019t think this is true at all. And with companies like IBM and Google actually making quantum devices, the time to start playing with quantum programming is now.
Donu2019t give up and go start your journey. Try out the following IBM Q Python SDK
------
What does "params:id" do in Ruby on Rails?
Let's say we have a Post model.
In our routes.rb file, we probably have something like this:resources :postsIf we run rake routes to see the URLs that are generated from this line in our routes file, we see terminal output like this:Some of the generated URLs have this :id component. This component is known as a dynamic URL fragment, which is basically a placeholder for any value you enter.
Thus, you can visit /posts/1, /posts/2 and so forth without having to hardcode full URLs for every possible path you can visit. Now, when you visit /posts/1 the request is dispatched to the PostsController, namely the show action. In every controller, you have access to a params hash, and in this instance, you will have a top-level key id with a value of 1.
As a result, from the controller, you can have some code to the tune of:def show post Post. find(params:id)end(Normally, this would be an instance variable, but for some reason the editor does not allow the @ symbol within a code block).params:id is 1, so you will pull in the first Post from the database.
NB: You aren't restricted to have the dynamic URL fragment be named id. You can change it like so:Now, when we do rake routes, we see:Good luck. Shoot me a message if you have any other questions!