{"id":194,"date":"2009-02-06T19:19:11","date_gmt":"2009-02-07T00:19:11","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/programando\/?p=194"},"modified":"2009-02-06T22:37:52","modified_gmt":"2009-02-07T03:37:52","slug":"operadores-en-lenguaje-c","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/programando\/operadores-en-lenguaje-c\/","title":{"rendered":"Operadores en Lenguaje C"},"content":{"rendered":"<p class=\"MsoNormal\">El lenguaje C permite manejar una gran variedad de operadores como lo son: Operadores aritm\u00e9ticos, l\u00f3gicos, de asignaci\u00f3n, relacionales.<\/p>\n<p class=\"MsoNormal\"><!-- \t\t@page { margin: 2cm } \t\tP { margin-bottom: 0.21cm } --><\/p>\n<p><strong>Operadores Aritm\u00e9ticos<\/strong><\/p>\n<table style=\"height: 175px\" dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"7\" width=\"617\" align=\"left\">\n<tbody>\n<tr valign=\"top\">\n<td width=\"56\"><strong><span style=\"font-family: Times New Roman,serif\">Operador<\/span><\/strong><\/td>\n<td width=\"61\"><strong><span style=\"font-family: Times New Roman,serif\">Nombre<\/span><\/strong><\/td>\n<td width=\"227\"><strong><span style=\"font-family: Times New Roman,serif\">Descripci\u00f3n<\/span><\/strong><\/td>\n<td width=\"164\"><strong><span style=\"font-family: Times New Roman,serif\">Sentido<\/span><\/strong><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"56\"><span style=\"font-family: Times New Roman,serif\">+<\/span><\/td>\n<td width=\"61\"><span style=\"font-family: Times New Roman,serif\">Suma<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Suma dos n\u00fameros<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"56\"><span style=\"font-family: Times New Roman,serif\">-<\/span><\/td>\n<td width=\"61\"><span style=\"font-family: Times New Roman,serif\">Resta<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Resta dos n\u00fameros<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"56\"><span style=\"font-family: Times New Roman,serif\">\/<\/span><\/td>\n<td width=\"61\"><span style=\"font-family: Times New Roman,serif\">Divisi\u00f3n<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Divide dos n\u00fameros<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"56\"><span style=\"font-family: Times New Roman,serif\">*<\/span><\/td>\n<td width=\"61\"><span style=\"font-family: Times New Roman,serif\">Producto<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Multiplica dos n\u00fameros<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"56\"><span style=\"font-family: Times New Roman,serif\">%<\/span><\/td>\n<td width=\"61\"><span style=\"font-family: Times New Roman,serif\">Resto<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Calcula\u00a0 el resto de una \t\t\tdivisi\u00f3n<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Operadores L\u00f3gicos<\/strong><\/p>\n<table style=\"height: 118px\" dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"7\" width=\"621\" align=\"left\">\n<tbody>\n<tr valign=\"top\">\n<td width=\"57\"><strong><span style=\"font-family: Times New Roman,serif\">Operador<\/span><\/strong><\/td>\n<td width=\"60\"><strong><span style=\"font-family: Times New Roman,serif\">Nombre<\/span><\/strong><\/td>\n<td width=\"227\"><strong><span style=\"font-family: Times New Roman,serif\">Descripci\u00f3n<\/span><\/strong><\/td>\n<td width=\"164\"><strong><span style=\"font-family: Times New Roman,serif\">Sentido<\/span><\/strong><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"57\"><span style=\"font-family: Times New Roman,serif\">!<\/span><\/td>\n<td width=\"60\"><span style=\"font-family: Times New Roman,serif\">No l\u00f3gico<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Realiza la operaci\u00f3n \t\t\tl\u00f3gica NOT<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"57\"><span style=\"font-family: Times New Roman,serif\">&amp;&amp;<\/span><\/td>\n<td width=\"60\"><span style=\"font-family: Times New Roman,serif\">Y l\u00f3gico<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Realiza la operaci\u00f3n \t\t\tl\u00f3gica AND<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"57\"><span style=\"font-family: Times New Roman,serif\">||<\/span><\/td>\n<td width=\"60\"><span style=\"font-family: Times New Roman,serif\">\u00d3 l\u00f3gico<\/span><\/td>\n<td width=\"227\"><span style=\"font-family: Times New Roman,serif\">Realiza la operaci\u00f3n \t\t\tl\u00f3gica OR<\/span><\/td>\n<td width=\"164\"><span style=\"font-family: Times New Roman,serif\">De izquierda a derecha<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Operadores Relacionales<\/strong><\/p>\n<table style=\"height: 278px\" dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"7\" width=\"618\" align=\"left\">\n<tbody>\n<tr>\n<td width=\"58\"><strong><span style=\"font-family: Times New Roman,serif\">Operador<\/span><\/strong><\/td>\n<td width=\"80\"><strong><span style=\"font-family: Times New Roman,serif\">Nombre<\/span><\/strong><\/td>\n<td width=\"250\"><strong><span style=\"font-family: Times New Roman,serif\">Descripci\u00f3n<\/span><\/strong><\/td>\n<td width=\"130\"><strong><span style=\"font-family: Times New Roman,serif\">Sentido<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"58\"><span style=\"font-family: Times New Roman,serif\">==<\/span><\/td>\n<td width=\"80\"><span style=\"font-family: Times New Roman,serif\">Igual a<\/span><\/td>\n<td width=\"250\"><span style=\"font-family: Times New Roman,serif\">Compara dos \t\t\tvalores y devuelve verrdadero (1) si son iguales.<\/span><\/td>\n<td width=\"130\"><span style=\"font-family: Times New Roman,serif\">De izquierda a \t\t\tderecha<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"58\"><span style=\"font-family: Times New Roman,serif\">!=<\/span><\/td>\n<td width=\"80\"><span style=\"font-family: Times New Roman,serif\">Diferente de<\/span><\/td>\n<td width=\"250\"><span style=\"font-family: Times New Roman,serif\">Compara dos \t\t\tvalores y devuelve verrdadero (1) si son diferentes.<\/span><\/td>\n<td width=\"130\"><span style=\"font-family: Times New Roman,serif\">De izquierda a \t\t\tderecha<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"58\"><span style=\"font-family: Times New Roman,serif\">&gt;<\/span><\/td>\n<td width=\"80\"><span style=\"font-family: Times New Roman,serif\">Mayor que<\/span><\/td>\n<td width=\"250\"><span style=\"font-family: Times New Roman,serif\">Compara dos \t\t\tvalores y devuelve verrdadero  si el izquierdo es mayor que el \t\t\tderecho.<\/span><\/td>\n<td width=\"130\"><span style=\"font-family: Times New Roman,serif\">De izquierda a \t\t\tderecha<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"58\"><span style=\"font-family: Times New Roman,serif\">&gt;=<\/span><\/td>\n<td width=\"80\"><span style=\"font-family: Times New Roman,serif\">Mayor o igual \t\t\tque<\/span><\/td>\n<td width=\"250\"><span style=\"font-family: Times New Roman,serif\">Compara dos \t\t\tvalores y devuelve verrdadero  si el izquierdo es mayor  o igual \t\t\tque el derecho.<\/span><\/td>\n<td width=\"130\"><span style=\"font-family: Times New Roman,serif\">De izquierda a \t\t\tderecha<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"58\"><span style=\"font-family: Times New Roman,serif\">&lt;<\/span><\/td>\n<td width=\"80\"><span style=\"font-family: Times New Roman,serif\">Menor que<\/span><\/td>\n<td width=\"250\"><span style=\"font-family: Times New Roman,serif\">Compara dos \t\t\tvalores y devuelve verrdadero  si el izquierdo es menor que el \t\t\tderecho.<\/span><\/td>\n<td width=\"130\"><span style=\"font-family: Times New Roman,serif\">De izquierda a \t\t\tderecha<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"58\"><span style=\"font-family: Times New Roman,serif\">&lt;=<\/span><\/td>\n<td width=\"80\"><span style=\"font-family: Times New Roman,serif\">Menor o igual \t\t\tque<\/span><\/td>\n<td width=\"250\"><span style=\"font-family: Times New Roman,serif\">Compara dos \t\t\tvalores y devuelve verrdadero  si el izquierdo es menor o igual \t\t\tque el derecho.<\/span><\/td>\n<td width=\"130\"><span style=\"font-family: Times New Roman,serif\">De izquierda a \t\t\tderecha<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><!--[if gte mso 9]&gt;  Normal 0   21   false false false  ES X-NONE X-NONE              MicrosoftInternetExplorer4              &lt;![endif]--><!--[if gte mso 9]&gt;                                                                                                                                            &lt;![endif]--><\/p>\n<p><strong>Operadores de asignaci\u00f3n<\/strong><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"7\" width=\"618\">\n<tbody>\n<tr>\n<td width=\"13%\"><strong><span style=\"font-family: Times New Roman,serif\">Operador<\/span><\/strong><\/td>\n<td width=\"16%\"><strong><span style=\"font-family: Times New Roman,serif\">Nombre<\/span><\/strong><\/td>\n<td width=\"46%\"><strong><span style=\"font-family: Times New Roman,serif\">Descripci\u00f3n<\/span><\/strong><\/td>\n<td width=\"25%\"><strong><span style=\"font-family: Times New Roman,serif\">Sentido<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">++<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Incremento<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Incrementa en \t\t\tuno al valor actual de una variable<\/span><\/td>\n<td width=\"25%\"><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">--<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Decremento<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Decrementa en \t\t\tuno al valor actual de una variable<\/span><\/td>\n<td width=\"25%\"><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">=<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Asignaci\u00f3n<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Asigna un \t\t\tvalor dado a una variable<\/span><\/td>\n<td width=\"25%\"><span style=\"font-family: Times New Roman,serif\">De derecha  a \t\t\tizquierda<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">+=<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Incremento de<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Incrementa en \t\t\tuna cantidad dada al valor de una variable<\/span><\/td>\n<td width=\"25%\"><span style=\"font-family: Times New Roman,serif\">De derecha  a \t\t\tizquierda<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">-=<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Decremeto de<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Decrementa en \t\t\tuna cantidad dada al valor de una variable<\/span><\/td>\n<td width=\"25%\"><span style=\"font-family: Times New Roman,serif\">De derecha  a \t\t\tizquierda<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">*=<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Asignaci\u00f3n \t\t\tdel producto<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Multiplica al \t\t\tvalor de una variable con un n\u00famero dado y se lo asigna a  la \t\t\tmisma.<\/span><\/td>\n<td width=\"25%\"><span style=\"font-family: Times New Roman,serif\">De derecha  a \t\t\tizquierda<\/span><\/td>\n<\/tr>\n<tr>\n<td width=\"13%\"><span style=\"font-family: Times New Roman,serif\">\/=<\/span><\/td>\n<td width=\"16%\"><span style=\"font-family: Times New Roman,serif\">Asignaci\u00f3n de \t\t\tla divisi\u00f3n<\/span><\/td>\n<td width=\"46%\"><span style=\"font-family: Times New Roman,serif\">Divide al \t\t\tvalor de una variable para un n\u00famero dado y se lo asigna a  la \t\t\tmisma.<\/span><\/td>\n<td width=\"25%\"><span style=\"font-family: Times New Roman,serif\">De derecha  a \t\t\tizquierda<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>En el caso de los operadores incremento y decremento, se los puede colocar a la derecha<br \/>\nde la variable (operaci\u00f3n post-incremento\/decremento) o a la izquierda (operaci\u00f3n<br \/>\npre-incremento\/decremento). Al usar estos operadores en modo post-incremento\/decremento<br \/>\nprimero se eval\u00faa la variable y luego se le\u00a0 suma o resta 1. En el caso de los operadores<br \/>\npre-incremento\/decremento primero se le suma o resta 1 al valor de la variable y luego<br \/>\nse eval\u00faa la misma.<\/p>\n<p>Ejemplos:<\/p>\n<pre><em>Post-Incremento<\/em>\r\n\r\n<strong>#include<\/strong> &lt;stdio.h&gt;<strong>\r\nvoid<\/strong> main(){\r\n<span><span style=\"color: #666699\">\t<\/span><\/span><strong>int<\/strong> a,b;\r\n<span><span style=\"color: #666699\">\t<\/span><\/span>a=10;\r\n<span><span style=\"color: #666699\">\t<\/span><\/span>b=a++;\t<span style=\"color: #666699\">\/\/A la variable <strong>b<\/strong> se le asigna el valor de <strong>a<\/strong>; luego el valor\r\n<\/span><span><span style=\"color: #666699\">\t<\/span><\/span><span><span style=\"color: #666699\">\t<\/span><\/span><span style=\"color: #666699\">\/\/de la variable <strong>a<\/strong> se incrementa en 1<\/span>\r\n}<\/pre>\n<p><em>Pre-Incremento<\/em><\/p>\n<pre><strong>#include<\/strong> &lt;stdio.h&gt;<strong>\r\nvoid<\/strong> main()\r\n{\r\n<span><span style=\"color: #666699\">\t<\/span><\/span>int a,b;\r\n<span><span style=\"color: #666699\">\t<\/span><\/span>a=10;\r\n<span><span style=\"color: #666699\">\t<\/span><\/span>b=++a; \t<span style=\"color: #666699\">\/\/El valor de a es incrementado en 1 y luego este valor es asignado a\t\t\r\n<\/span><span><span style=\"color: #666699\">\t<\/span><\/span><span><span style=\"color: #666699\">\t<\/span><\/span><span style=\"color: #666699\">\/\/la variable b<\/span>\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>El lenguaje C permite manejar una gran variedad de operadores como lo son: Operadores aritm\u00e9ticos, l\u00f3gicos, de asignaci\u00f3n, relacionales. Operadores Aritm\u00e9ticos Operador Nombre Descripci\u00f3n Sentido + Suma Suma dos n\u00fameros De izquierda a derecha - Resta Resta dos n\u00fameros De izquierda a derecha \/ Divisi\u00f3n Divide dos n\u00fameros De izquierda a derecha * Producto Multiplica [&hellip;]<\/p>\n","protected":false},"author":385,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2722,3359],"tags":[3913,2851,2850,3912,3911,6085,2842,3914,2848,3915,3916,2852],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-aprende-a-programar","category-lenguaje-c","tag-and","tag-aritmeticos","tag-asignacion","tag-decremento","tag-incremento","tag-lenguaje-c","tag-logicos","tag-not","tag-operadores","tag-or","tag-relacionales","tag-resto"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/users\/385"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":18,"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":200,"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/posts\/194\/revisions\/200"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/programando\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}