source - http://www.cprogramming.com/tips/
Friday, October 25, 2013
How to Learn to Program in C
How to Learn to Program in C
Edited by Eshafer, Nicole Willson, Vikram Kumar Rohra, Horses4Ever and 27 others
C is a powerful programing language that was first developed in the 1970's. Depending on your previous programming experience, it may take time and patience to learn C. However, once learned, learning other programming languages will come naturally. While learning the entire language is beyond the scope of this article, it will get you started in the right direction.
EditSteps
- 1First find a compiler that is compatible with your operating system, and decide whether you want to run an Integrated Development Environment (IDE) or if you want to edit C files manually through an editor like Notepad and compile from the command line.
- If you're a Windows user, try using Visual C++ Express Edition which is available for download for free.
- If you're a Mac user, you can use Xcode, available from the Leopard install disk or the App Store for free.
- If you're a GNU/Linux user, try KDevelop or Eclipse. Eclipse is also available for Windows.
- Alternatively, you can use the command line tools (GCC runs under any Unix and it is possible to run it under Windows and Mac).
- Tiny C Compiler (TCC) is great if you don't want to get a ton of bells and whistles that come with other compilers
-
2Learn how to compile and run a basic program, this will be your first program, typically it will just print "Hello World" to the screen and exit. Don't worry about all the minor details of the syntax, just become comfortable with compiling and running.
-
3Learn about variable types, such as the difference between char, int, float, double, etc.
-
4Learn about the concept of variables, arrays and functions. Variables are where information is stored, functions are pieces of code that can be executed and arrays are groups of data of the same type.
-
5Learn pointers. Pointers are very important in C since you can directly access memory contents through pointers, unlike Java. The drawback to this is that if your program isn't thoroughly tested, it can crash.
-
6Learn conditional statements, such as the "if" and "switch" statements. The "if" statement will be one of your most frequently used statements, you can execute code based on whether a condition is true or not (e.g. whether the color the user provided was red).
-
7Learn loops. Learn the difference of the "for" loop and the "while" loop - make sure to avoid infinite loops! Learn the continue and break statements.
-
8Learn data structures. Although data structures are not directly related to programming, but for an advanced user, knowledge of basic concepts in Computer Science is essential.
-
9Start with small programs. When you are making your own code, try to identify the most essential part of the problem - is it the data input or the calling of the functions, the structure of the loop (these are some very elementary examples) and start from there. Then build upon that in small increments.
-
10Learn key steps about debugging. Although it looks little complicated in the beginning, but if you have a large source code, then using print statements gets little overwhelming.
- 11Enroll yourself in some of the mailing lists online. You can post your own of questions and support other new users.
- 12Remember, the key to learning anything new is perseverance & hard work.
EditSample Code
Function to calculate the greatest common divisor (using the euclidean algorithm):
int gcd(int u, int v)
{
int r;
while (v != 1)
{
r = u % v;
u = v;
v = r;
}
return u;
}
The function takes two integers named 'u' and 'v' and returns an integer. The function has the name 'gcd'.
Function to calculate xy:
int power(int x, int y)
{
int result = -1
;
int i;
for(i = 1; i < y; i++)
result *= x;
return result;
}
The function takes two integers named 'x' and 'y' and returns an integer. The function has the name 'power'.
EditTips
- Your source code needs to have a *.c extension, so that your compiler can understand that it's a C source file.
- Find a good C programming book. A recommendable C resource book is "The C Programming Language" by Brian W. Kernighan, Dennis Ritchie (ISBN 0131103628 - You can a free electronic copy of the original draft here). Find a book that has tutorials and projects to facilitate your exposure to C.
- Always add comments to your programs. Not only does this help others who might take a look at its source code, but also it helps you remember what you're writing and why. You may know what you're doing the moment that you're writing your code, but after two or three months, you won't remember much.
- Don't try to avoid mistakes; embrace them. Making mistakes is the most important part in learning how to programm.
- Remember, C is a programming language. Learning a programming language may not necessarily lead to learning to program, which is more about problem solving than about compiling and running a program in a specific language.
- When encountering a syntax error when compiling, if you're stumped, search Google (or another search engine) with the error you received. Chances are someone has already experienced the same problem and posted a solution. source - http://www.wikihow.com/Learn-to-Program-in-C
Apple's 'Next Big Thing' - Get Updated
Apple's 'Next Big Thing' Will Be an Innovation, Not an Invention
Lots of people are wondering what Apple will invent next. If it’s true to its own history, it won’t invent a new type of product but will improve on one someone else already brought to market.
I’ve never questioned that Apple is an innovator. Its iPod, iPhone and iPad were all very innovative products. But all of them were improvements of other companies’ products or concepts in the same categories.
The iPod, introduced in October 2001, was not the first digital music player. Diamond Multimedia announced the Rio PMP 300 in 1998, and the Creative Nomad Jukebox and Archos Jukebox came out in 2000. None of these products would have been possible were it not for innovations in storage, compression and battery life from scores of scientists and inventors.
Apple did a great job by combining the hardware with its iTunes software and its music store. And that, plus Steve Jobs’ brilliant marketing, is why the iPod soon became the dominant music player.
The iPhone, which came out in 2007, was far from the first smartphone. Depending on how you define “smart,” there were products from PSiAn, Symbian,Nokia and of course Research In Motion (now BlackBerry), which debuted in 1999. The first Android phone didn’t hit the street until 2008, but the open-source version of the Android operating system — backed by Google – was introduced in 2003 by Andy Rubin, who just recently stepped down as Android head at Google.
Microsoft Windows Mobile came out years before the iPhone. Apple wasn’t even the first company to come out with a touch-screen smartphone. That honor goes to the IBM Simon Personal Communicator that was first introduced in 1992.
But, as with the iPod, Apple did it right. It was the first touch-screen smartphone to be highly useful. Sure, there was a lot of hype, but the phone earned that hype by delighting millions of users and becoming the gold standard by which other phones continue to be judged. Even now, when BlackBerry, Samsung or anyone else introduces a new smartphone, reviewers immediately compare it to Apple’s most recent iPhone.
The iPad, which first came out in 2010, was also an incredibly innovative product. But there were plenty of tablets on the market from a variety of companies going back more than 10 years. I was at the Comdex computer trade show in November 2001 when Bill Gates announced Windows software for the tablet PC. Gates at the time predicted that the tablet would become the most popular form of PC within five years. That was more than nine years ahead of the Apple iPad.
Microsoft’s early attempts at tablet operating systems were a bust. But after Apple reinvented the category, Microsoft is at it again with its Windows 8 operating system and its own Surface tablets. Apple does get credit for introducing the Newton MessagePad in 1992. It failed but it was an early example of a tablet-like personal digital assistant.
For a bit of perspective on tablet computers, scroll down to view the 1994 video about the “Tablet Newspaper” from a design lab at Knight Ridder, which at the time was the parent company of the San Jose Mercury News and other newspapers. What you’ll see in this 13 minute video is a tablet with a lot of features that ultimately appeared in the iPad. Of course, Knight Ridder never actually marketed the device so, once again, Apple deserves the credit for turning a good idea into a great product.
So when thinking about what Apple will do next, look around at products that already exist but could use some major improvements. Some say it will be a “smart” watch. Indeed, there are already plenty of those on the market but none are blockbuster products. It could be an Internet-connected “smart” TV if Apple can find a way to greatly improve on what other companies have done, including Samsung, Sony and LG.
Apple could also put its toe in the home automation arena, competing with lots of smaller companies. Might Apple try to compete with LG’s “smart” refrigerator? I doubt it, but I do hope Apple will try its hand at automotive products. I don’t expect to see an iCar anytime soon, but an iDash entertainment/communications/navigation unit would be a feasible and welcome competitor to all the not-so-great systems already on the market.
So let’s hope CEO Tim Cook, along with Apple’s engineers and designers, are busy looking around at other companies’ promising products that don’t quite meet up to Apple’s high standards. Apple doesn’t have to create new categories to change the world — it just has to build products that people love and then convince us that we can’t live without them.
Friday, April 19, 2013
National conference on education in Pune
A national conference titled Utkarsh รข€” Challenges & Opportunities in Business Management and Information Technology was organised by Dr D Y Patil School of Management and Dr D Y Patil School of MCA, at D Y Patil Knowledge City, Pune, recently received an overwhelming response and was appreciated widely. Dr Ajeenkya D Y Patil, chairman, D Y Patil Knowledge City, presided over the inaugural ceremony and Dr W N Gade, vice chancellor, University of Pune, was the chief guest for the occasion.
Dr Ajeenkya DY Patil elaborated on the need for an open education system. He laid strong emphasis on education for economically deprived sections of society. He further added that in keeping with the noble tradition of the D Y Patil Group, the D Y Patil Knowledge City Pune also endeavours to bring world class education to the doorstep of the common man.
In his inaugural speech, Dr W N Gade stressed on the significance of the difference between academics and industrial culture. He observed that despite having the technological expertise, India lacks behind China purely due to non-utilisation of the existing potential. He suggested that the work culture should be changed in Indian organisations to improve the efficiency and effectiveness of performance. He focussed on the need of a leader for every organisation and how a good leadership can bring about a remarkable difference to an organisation.
Amongst the keynote speakers were Dr S G Bhirud, advisor, AICTE, New Delhi; Prof B K Mohanty, IIM, Lucknow. Dr S B Kolte, executive president, Management Association of MCA Institutes, (MAMI) Maharashtra; Col Prem Anand, general manager, DCC&A and Dr Sachin Vernekar, director, BVIMR, Pune. Prof B G Bhandarkar, director (corporate relations) D Y Patil Knowledge city; Advt Sushant Patil, director, D Y Patil Knowledge city and Praveen Patil, chief administrative officer, D Y Patil Knowledge city were the guests of honour. The convener of the conference Prof (Dr) O P Haldar gave the vote of thanks at the event.
Source-
Sunday, April 14, 2013
National conference on animal disaster management to be held in New Delhi
MUMBAI: Every year huge numbers of animals suffer and die as a result of natural disasters in India. This loss has a dramatic impact on people as they desperately need healthy animals in order to survive and to rebuild their lives. Taking action to ensure animals are protected when disasters strike, the government of India in collaboration with World Society for the Protection of Animals (WSPA) is holding Asia's first national conference on animal disaster management in New Delhi on April 17-18.
The conference will be co-hosted by the National Disaster Management Authority (NDMA) and WSPA, which has been working globally during disasters to protect animals for almost 50 years. Currently a WSPA team is in Maharashtra helping animals caught-up in the drought by providing feed and shelter in cattle camps to benefit 9,000 buffalos and cattle.
Source - http://articles.timesofindia.indiatimes.com/2013-04-11/mumbai/38461922_1_disasters-ndma-animals
Veteran playback singer PB Srinivas passes away
Chennai: Veteran playback singer PB Srinivas passed away earlier on Sunday. 82-year-old Srinivas had lent his voice in all four South Indian languages besides Hindi.
The octogenarian was the playback singer of Kannada superstar Rajkumar and Tamil veteran Gemini Ganesan. Srinivas is survived by two sons and daughter.
In fact, it is believed that Srinivas's gentle voice suited Ganesan best. The duo produced some of the most memorable Tamil songs together including 'Kaalangalil Aval Vasantham' and 'Mayakkama Thayakkama' among many others.
Delhi: Bus driver arrested for molesting 8-year-old girl
New Delhi: In a shocking incident of crime against children in the national capital, a 42-year-old driver allegedly molested an eight-year-old girl in a bus in Sultanpuri area.
The incident took place on Saturday evening, when the girl was playing in the bus which was parked near the slum cluster of Sultanpuri.
Rakesh the driver of that bus reportedly molested the minor girl inside the bus. He has been arrested and charged with sexual assault under the new anti-rape law.
Rakesh reportedly molested the minor girl inside the bus which was parked near the slum cluster of Sultanpuri.
Police said the incident came to light on Sunday after the victim narrated the incident to her parents.
The parents then approached the police who took her to a hospital where a medical examination confirmed sexual assault.
Monday, April 8, 2013
MTNL To Deploy Routers Developed By IIT-Bombay
The Mahanagar Telephone Nigam Limited has signed an agreement with the Electronic Corporation of India Ltd (ECIL) to deploy Carrier Ethernet Switch Routers (CESRs) in Mumbai. The CESRs are manufactured by ECIL under license from IIT Bombay. At a ceremony held at IIT Bombay, MTNL and ECIL signed a MOU to deploy indigenous CESRs in 8 sites across Mumbai. This is perhaps the first occasion where a carrier-class technology developed at an academic institution finds way to a tier-1 provider in India in the transport network.
The salient features of these CESRs is that these will provide for excellent service oriented communications and form the backbone of future next generation telecommunication services such as leased services, software defined networking and secure communications. Conceptualized, developed at IIT Bombay, the CESRs are now manufactured by ECIL. The CESRs have an all-time low 1-microsecond port-to-port latency that makes them fastest in the business. The low latency also translates to low power consumption and small foot-print. Being indigenous the CESRs provide an additional level of security keeping customer data safe and secure.
MTNL will deploy the CESRs in 8-sites across the island city of Mumbai in an interconnected ring topology. From each site, MTNL will offer carrier-class services to enterprise customers, government agencies and other bodies. These services would include Ethernet, leased lines and MPLS network access from 10 Mbps to 10Gbps. The backbone of the network that would interconnect the CESRs will consist of 10Gbps links that would route Carrier Ethernet and Optical Transport Network (OTN) packets. The excellent latency, low energy consumption will be new features that would be brought out by MTNL for customers across the city of Mumbai.
Presiding over the signing ceremony, Prof. Devang Khakhar, Director, IIT Bombay commented that the deployment of IIT Bombay licensed technology would set a new benchmark in technology adoption from the IIT system to industry.
It must also be noted that MTNL has deployed an earlier version of the CESRs in their data center since May 2011. Prof. Khakhar commended the visionary leadership of MTNL and thanked its Executive Director Shri. Peeyush Agrawal for taking this critical step forward towards indigenization.
CMD ECIL, Shri. P. Sudhakar commented on the occasion stating that ECIL was proud to have collaborated with IIT Bombay to bring this technology to the market. He also thanked MTNL for giving this opportunity to deploy the CESRs in MTNL’s network.
Microsoft working on Google Glass competitor?
A new report on Apple Insider states that Microsoft is working on its version of smart glasses which could compete with Google Glass.
The report is based on analyst Brian White’s note to investors where he said that Microsoft is planning to bring a set of Internet-connected glasses to the market next year.
The report adds, White believes that Google Glass will kick off what he sees as a “major push” in wearable electronics by the biggest tech companies.
As far as Google Glass is concerned, the device expected the hit the stores later this year. At a TED Talk, Google co-founder and the man behind the Glass project, Sergey Brin had said that the devices would hit the stores this year. He also promised that the price would be much less than the current $1500 price tag that the developer versions carry.
At the recent SXSW conference in Austin, Google had showed Gmail, Path, EverNote, New York Times apps for Google Glass. More on how the apps work here.
The prototype version of the Glass has Bluetooth, WiFi and GPS and an integrated camera.
Technology, Education and Brains Team Up at Startup Weekend
Startup Weekend EDU had five teams working together with technology, education and the future in mind.
The teams pitched their next big idea to a panel of judges on Sunday night after having just 56 hours to work with teammates, whom they've never met, on how to make that idea a reality.
With help from business and design mentors along the way, they were able to learn, grow and sculpt their dreams into ones that will have an impact.
"It's really nice to hear from other people who have been there and have done it successfully," said Brendan Younger, a former science teacher who says he wants to share class experiments with more and more kids using technology. "Just to know that it's possible and that you don't have to become the next Facebook to be successful at all that's always a big morale booster and motivation."
Many participants are entrepreneurs, web designers and teachers. All working together to bring technology and teaching together for a better future in Albemarle County.
Organizers said there have been thousands of Startup Weekends all around the world but only a few years ago Startup Weekend EDU began.
They say some of the participants will quit their current job on Monday because they're so inspired and determined after the weekend is over that they know now their idea could actually work.
Monday, April 1, 2013
Hackers attack several BBC Twitter accounts
A series of tweets about fake weather conditions in Middle Eastern countries began appearing on Thursday afternoon.
The accounts are the latest in a series of large corporate Twitter feeds to have been breached.
The BBC said that it now has control of all three accounts and all inappropriate content has been deleted.
A BBC spokeswoman said: "We apologise to our audiences that this unacceptable material appeared under the BBC's name."
The attacks began in the early afternoon on Thursday. At the same time, BBC staff were alerted to a phishing email that had been sent to some BBC email accounts. It is not yet clear if the two are related.
The email contained a link that if clicked on could expose password details.
The BBC weather Twitter feed, which has 60,000 followers, was among those affected.
Alongside the standard tweets from the weather feed such as "'last night was chilly" some more bizarre comments began emerging.
They included: "Saudi weather station down due to head-on collision with camel."
Another read: "Chaotic weather forecast for Lebanon as the government decides to distance itself from the Milky Way."
The group claiming responsibility has previously spread messages in support of Syrian President Bashar-al-Assad.
The BBC's Arabic and Radio Ulster feeds were also affected.
Faris Couri, BBC Arabic's editor-in-chief said in a statement: "Today at around 11.00GMT, BBC Arabic's twitter account @BBCArabicOnline was hacked. Since then, several pro-Assad news tweets were published by the account.
"We strongly condemn such action and apologise to our audiences," he said.
Social engineering
The attacks on the BBC are the latest in a series of hacks on high-profile Twitter accounts.
Last month Burger King and Chrysler saw their Twitter feeds hijacked while a quarter of a million Twitter users had their passwords stolen.
"The BBC is an obvious place to attack as it a trusted brand and so anyone who wishes to broadcast a message can reach a audience that are likely to pay attention, certainly initially," said Prof Alan Woodward from the department of computing at the University of Surrey.
"The most likely source of the hack is via social engineering - someone managing to elicit the password by fooling the user who keeps the password," he added.
Increasingly experts are now calling for Twitter to step up security and offer two-factor authentication, essentially a disposable, single-use password for its users.
Writing about the hack on his blog, security consultant Graham Cluley said it was unclear how the password had been cracked.
"The good news is that the hack doesn't appear to have been done with the intention of spreading malicious links or scams. Instead, it appears that the Syrian Electronic Army are trying to spread political messages about Syria instead," he said.
"You should always use hard-to-guess, hard-to-crack, unique passwords for your online accounts that you are not using anywhere else on the web."
Subscribe to:
Posts (Atom)